1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-28 20:36:42 +00:00

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.
This commit is contained in:
AnyOldName3 2020-10-03 02:19:38 +01:00
parent 4faaa86449
commit 9e78f3d936

View file

@ -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 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 btFrom = Misc::Convert::toBullet(from);
btVector3 btTo = Misc::Convert::toBullet(to); btVector3 btTo = Misc::Convert::toBullet(to);