Use chode character actor.SetMomentum() to force full restore Velocity in scenepresence TeleportWithMomentum(), since actor.Velocity was selected by original coders as the input of a desired velocity (even 'forces') that is modified by character conditions, like not changing velocity.Z if it is in free fall.

avinationmerge
UbitUmarov 2012-04-14 05:07:52 +01:00
parent b574d43c5d
commit 3999822e13
2 changed files with 22 additions and 2 deletions

View File

@ -1082,7 +1082,9 @@ namespace OpenSim.Region.Framework.Scenes
CheckLandingPoint(ref pos); CheckLandingPoint(ref pos);
AbsolutePosition = pos; AbsolutePosition = pos;
AddToPhysicalScene(isFlying); AddToPhysicalScene(isFlying);
Velocity = vel; if (PhysicsActor != null)
PhysicsActor.SetMomentum(vel);
SendTerseUpdateToAllClients(); SendTerseUpdateToAllClients();
} }

View File

@ -140,6 +140,10 @@ namespace OpenSim.Region.Physics.OdePlugin
public int m_eventsubscription = 0; public int m_eventsubscription = 0;
private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate();
private Vector3 m_taintMomentum = Vector3.Zero;
private bool m_haveTaintMomentum = false;
// unique UUID of this character object // unique UUID of this character object
public UUID m_uuid; public UUID m_uuid;
public bool bad = false; public bool bad = false;
@ -800,8 +804,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (value.IsFinite()) if (value.IsFinite())
{ {
m_pidControllerActive = true;
_target_velocity = value; _target_velocity = value;
m_pidControllerActive = true;
} }
else else
{ {
@ -911,6 +915,12 @@ namespace OpenSim.Region.Physics.OdePlugin
public override void SetMomentum(Vector3 momentum) public override void SetMomentum(Vector3 momentum)
{ {
if (momentum.IsFinite())
{
m_taintMomentum = momentum;
m_haveTaintMomentum = true;
_parent_scene.AddPhysicsActorTaint(this);
}
} }
@ -1424,6 +1434,14 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
if (m_haveTaintMomentum)
{
m_haveTaintMomentum = false;
_velocity = m_taintMomentum;
_target_velocity = m_taintMomentum;
m_pidControllerActive = true;
d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z);
}
} }
} }