Allow jumping when you're stuck on a slope (fixes #4221)

0.6.3
Capostrophic 7 years ago committed by Capostrophic
parent bdfa430857
commit e32f38b939

@ -308,6 +308,7 @@ namespace MWPhysics
float swimlevel = waterlevel + halfExtents.z() - (physicActor->getRenderingHalfExtents().z() * 2 * fSwimHeightScale); float swimlevel = waterlevel + halfExtents.z() - (physicActor->getRenderingHalfExtents().z() * 2 * fSwimHeightScale);
ActorTracer tracer; ActorTracer tracer;
osg::Vec3f inertia = physicActor->getInertialForce(); osg::Vec3f inertia = physicActor->getInertialForce();
osg::Vec3f velocity; osg::Vec3f velocity;
@ -320,10 +321,11 @@ namespace MWPhysics
{ {
velocity = (osg::Quat(refpos.rot[2], osg::Vec3f(0, 0, -1))) * movement; velocity = (osg::Quat(refpos.rot[2], osg::Vec3f(0, 0, -1))) * movement;
if (velocity.z() > 0.f && physicActor->getOnGround() && !physicActor->getOnSlope()) if ((velocity.z() > 0.f && physicActor->getOnGround() && !physicActor->getOnSlope())
|| (velocity.z() > 0.f && velocity.z() + inertia.z() <= -velocity.z() && physicActor->getOnSlope()))
inertia = velocity; inertia = velocity;
else if (!physicActor->getOnGround() || physicActor->getOnSlope()) else if (!physicActor->getOnGround() || physicActor->getOnSlope())
velocity = velocity + physicActor->getInertialForce(); velocity = velocity + inertia;
} }
// dead actors underwater will float to the surface, if the CharacterController tells us to do so // dead actors underwater will float to the surface, if the CharacterController tells us to do so

Loading…
Cancel
Save