mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 00:32:49 +00:00
Allow jumping when you're stuck on a slope (fixes #4221)
This commit is contained in:
parent
bdfa430857
commit
e32f38b939
@ -308,6 +308,7 @@ namespace MWPhysics
|
||||
float swimlevel = waterlevel + halfExtents.z() - (physicActor->getRenderingHalfExtents().z() * 2 * fSwimHeightScale);
|
||||
|
||||
ActorTracer tracer;
|
||||
|
||||
osg::Vec3f inertia = physicActor->getInertialForce();
|
||||
osg::Vec3f velocity;
|
||||
|
||||
@ -320,10 +321,11 @@ namespace MWPhysics
|
||||
{
|
||||
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;
|
||||
else if(!physicActor->getOnGround() || physicActor->getOnSlope())
|
||||
velocity = velocity + physicActor->getInertialForce();
|
||||
else if (!physicActor->getOnGround() || physicActor->getOnSlope())
|
||||
velocity = velocity + inertia;
|
||||
}
|
||||
|
||||
// dead actors underwater will float to the surface, if the CharacterController tells us to do so
|
||||
|
Loading…
x
Reference in New Issue
Block a user