mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-01 12:09:50 +00:00
Revert "Replace rayTest
with convexSweepTest
MovementSolver::traceDown
. Needed to prevent teleporting down through sewer grates."
This reverts commit 917132e326
.
This commit is contained in:
parent
4394970894
commit
3a8a4e8bff
1 changed files with 4 additions and 10 deletions
|
@ -98,27 +98,21 @@ namespace MWPhysics
|
||||||
// Check if we actually found a valid spawn point (use an infinitely thin ray this time).
|
// Check if we actually found a valid spawn point (use an infinitely thin ray this time).
|
||||||
// Required for some broken door destinations in Morrowind.esm, where the spawn point
|
// Required for some broken door destinations in Morrowind.esm, where the spawn point
|
||||||
// intersects with other geometry if the actor's base is taken into account
|
// intersects with other geometry if the actor's base is taken into account
|
||||||
btVector3 from = Misc::Convert::toBullet(position + offset);
|
btVector3 from = Misc::Convert::toBullet(position);
|
||||||
btVector3 to = from - btVector3(0, 0, maxHeight);
|
btVector3 to = from - btVector3(0, 0, maxHeight);
|
||||||
|
|
||||||
btCollisionWorld::ClosestConvexResultCallback resultCallback1(from, to);
|
btCollisionWorld::ClosestRayResultCallback resultCallback1(from, to);
|
||||||
resultCallback1.m_collisionFilterGroup = CollisionType_AnyPhysical;
|
resultCallback1.m_collisionFilterGroup = CollisionType_AnyPhysical;
|
||||||
resultCallback1.m_collisionFilterMask = CollisionType_World | CollisionType_HeightMap;
|
resultCallback1.m_collisionFilterMask = CollisionType_World | CollisionType_HeightMap;
|
||||||
|
|
||||||
const btQuaternion btrot = btQuaternion::getIdentity();
|
collisionWorld->rayTest(from, to, resultCallback1);
|
||||||
collisionWorld->convexSweepTest(
|
|
||||||
actor->getConvexShape(), btTransform(btrot, from), btTransform(btrot, to), resultCallback1);
|
|
||||||
|
|
||||||
if (resultCallback1.hasHit()
|
if (resultCallback1.hasHit()
|
||||||
&& ((Misc::Convert::toOsg(resultCallback1.m_hitPointWorld) - tracer.mEndPos + offset).length2() > 35 * 35
|
&& ((Misc::Convert::toOsg(resultCallback1.m_hitPointWorld) - tracer.mEndPos + offset).length2() > 35 * 35
|
||||||
|| !isWalkableSlope(tracer.mPlaneNormal)))
|
|| !isWalkableSlope(tracer.mPlaneNormal)))
|
||||||
{
|
{
|
||||||
actor->setOnSlope(!isWalkableSlope(resultCallback1.m_hitNormalWorld));
|
actor->setOnSlope(!isWalkableSlope(resultCallback1.m_hitNormalWorld));
|
||||||
osg::Vec3f res = Misc::Convert::toOsg(resultCallback1.m_hitPointWorld);
|
return Misc::Convert::toOsg(resultCallback1.m_hitPointWorld) + osg::Vec3f(0.f, 0.f, sGroundOffset);
|
||||||
res.x() = position.x();
|
|
||||||
res.y() = position.y();
|
|
||||||
res.z() += sGroundOffset;
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actor->setOnSlope(!isWalkableSlope(tracer.mPlaneNormal));
|
actor->setOnSlope(!isWalkableSlope(tracer.mPlaneNormal));
|
||||||
|
|
Loading…
Reference in a new issue