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:
parent
4faaa86449
commit
9e78f3d936
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue