[Client] Remove inertia from players who are teleported via a packet

0.6.1
David Cernat 8 years ago
parent d7cbfc98eb
commit fbec0d9443

@ -297,6 +297,16 @@ namespace MWBase
///< Queues movement for \a ptr (in local space), to be applied in the next call to
/// doPhysics.
/*
Start of tes3mp addition
Make it possible to set the inertial force of a Ptr directly
*/
virtual void setInertialForce(const MWWorld::Ptr& ptr, const osg::Vec3f &force) = 0;
/*
End of tes3mp addition
*/
virtual bool castRay (float x1, float y1, float z1, float x2, float y2, float z2) = 0;
///< cast a Ray and return true if there is an object in the ray path.

@ -801,8 +801,10 @@ void LocalPlayer::setPosition()
else
{
world->getPlayer().setTeleported(true);
world->moveObject(ptrPlayer, position.pos[0], position.pos[1], position.pos[2]);
world->rotateObject(ptrPlayer, position.rot[0], position.rot[1], position.rot[2]);
world->setInertialForce(ptrPlayer, osg::Vec3f(0.f, 0.f, 0.f));
}
updatePosition(true);

@ -1512,6 +1512,19 @@ namespace MWWorld
mPhysics->queueObjectMovement(ptr, velocity);
}
/*
Start of tes3mp addition
Make it possible to set the inertial force of a Ptr directly
*/
void World::setInertialForce(const Ptr& ptr, const osg::Vec3f &force)
{
mPhysics->getActor(ptr)->setInertialForce(force);
}
/*
End of tes3mp addition
*/
void World::doPhysics(float duration)
{
mPhysics->stepSimulation(duration);

@ -398,6 +398,16 @@ namespace MWWorld
///< Queues movement for \a ptr (in local space), to be applied in the next call to
/// doPhysics.
/*
Start of tes3mp addition
Make it possible to set the inertial force of a Ptr directly
*/
void setInertialForce(const Ptr& ptr, const osg::Vec3f &force);
/*
End of tes3mp addition
*/
virtual bool castRay (float x1, float y1, float z1, float x2, float y2, float z2);
///< cast a Ray and return true if there is an object in the ray path.

Loading…
Cancel
Save