From 9e78f3d936c95b6add1d097f957e5a770beac813 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Sat, 3 Oct 2020 02:19:38 +0100 Subject: [PATCH] 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. --- apps/openmw/mwphysics/physicssystem.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index 91e7a9de0d..8b07fea4b2 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -264,6 +264,8 @@ namespace MWPhysics RayCastingResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, const MWWorld::ConstPtr& ignore, std::vector targets, int mask, int group) const { + if (from == to) + return RayCastingResult { false }; btVector3 btFrom = Misc::Convert::toBullet(from); btVector3 btTo = Misc::Convert::toBullet(to);