stop a Vehicle on a failed region cross (or empty border) (old ode)

LSLKeyTest
UbitUmarov 2015-11-20 19:11:26 +00:00
parent 53895289a6
commit 395d160c41
2 changed files with 13 additions and 0 deletions

View File

@ -607,6 +607,13 @@ namespace OpenSim.Region.PhysicsModule.ODE
m_body = pBody; m_body = pBody;
} }
internal void Stop()
{
m_lastLinearVelocityVector = Vector3.Zero;
m_lastAngularVelocity = Vector3.Zero;
m_lastPositionVector = d.BodyGetPosition(Body);
}
internal void Step(float pTimestep, OdeScene pParentScene) internal void Step(float pTimestep, OdeScene pParentScene)
{ {
if (m_body == IntPtr.Zero || m_type == Vehicle.TYPE_NONE) if (m_body == IntPtr.Zero || m_type == Vehicle.TYPE_NONE)

View File

@ -2676,10 +2676,16 @@ Console.WriteLine(" JointCreateFixed");
m_lastVelocity = _velocity; m_lastVelocity = _velocity;
if(m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE)
m_vehicle.Stop();
if (Body != IntPtr.Zero) if (Body != IntPtr.Zero)
{ {
d.BodySetLinearVel(Body, 0, 0, 0); // stop it d.BodySetLinearVel(Body, 0, 0, 0); // stop it
d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
enableBodySoft();
} }
outofBounds = false; outofBounds = false;