Fix drift of static prim.

avinationmerge
Kitto Flora 2011-01-20 06:51:50 +00:00
parent c0134710f7
commit bfa5b7850c
1 changed files with 13 additions and 1 deletions

View File

@ -545,6 +545,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (value.IsFinite()) if (value.IsFinite())
{ {
_velocity = value; _velocity = value;
if (_velocity.ApproxEquals(Vector3.Zero,0.001f))
_acceleration = Vector3.Zero;
m_taintVelocity = value; m_taintVelocity = value;
_parent_scene.AddPhysicsActorTaint(this); _parent_scene.AddPhysicsActorTaint(this);
@ -662,7 +664,14 @@ namespace OpenSim.Region.Physics.OdePlugin
public override Vector3 Acceleration // client updates read data via here public override Vector3 Acceleration // client updates read data via here
{ {
get { return _acceleration; } get
{
if (_zeroFlag)
{
return Vector3.Zero;
}
return _acceleration;
}
} }
@ -3122,6 +3131,7 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!");
_velocity.X = 0; _velocity.X = 0;
_velocity.Y = 0; _velocity.Y = 0;
_velocity.Z = 0; _velocity.Z = 0;
m_lastVelocity = Vector3.Zero;
m_rotationalVelocity.X = 0; m_rotationalVelocity.X = 0;
m_rotationalVelocity.Y = 0; m_rotationalVelocity.Y = 0;
m_rotationalVelocity.Z = 0; m_rotationalVelocity.Z = 0;
@ -3169,6 +3179,7 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!");
// Stop it in the phys engine // Stop it in the phys engine
d.BodySetLinearVel(Body, 0.0f, 0.0f, _velocity.Z); d.BodySetLinearVel(Body, 0.0f, 0.0f, _velocity.Z);
d.BodySetAngularVel (Body, 0.0f, 0.0f, 0.0f); d.BodySetAngularVel (Body, 0.0f, 0.0f, 0.0f);
d.BodySetForce(Body, 0f, 0f, 0f);
if (!m_lastUpdateSent) if (!m_lastUpdateSent)
{ {
@ -3620,6 +3631,7 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!");
d.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z); d.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z);
_target_velocity = Vector3.Zero; _target_velocity = Vector3.Zero;
d.BodySetLinearVel(Body, _target_velocity.X, _target_velocity.Y, _target_velocity.Z); d.BodySetLinearVel(Body, _target_velocity.X, _target_velocity.Y, _target_velocity.Z);
d.BodySetForce(Body, 0f, 0f, 0f);
} }
else else
{ {