Skip raycasting for zero-length rays

Rays with no length can't intersect anything. This also prevents an
assertion triggering with Bullet built in Debug mode.
pull/593/head
AnyOldName3 4 years ago
parent 4faaa86449
commit 9e78f3d936

@ -264,6 +264,8 @@ namespace MWPhysics
RayCastingResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore, std::vector<MWWorld::Ptr> targets, int mask, int group) const
{
if (from == to)
return RayCastingResult { false };
btVector3 btFrom = Misc::Convert::toBullet(from);
btVector3 btTo = Misc::Convert::toBullet(to);

Loading…
Cancel
Save