From 9fdd1753fa535ea710afc18753529aa3d12a09c6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 29 Oct 2011 02:30:33 +0100 Subject: Add taint target velocity for ODECharacters as is already done for ODECharacter position and position and velocity for ODEPrims. This is to help stop surprises if the velocity is set in the middle of physics calculations, though this probably isn't a huge problem. It's more for consistency and for the next step of removing some scene locks --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 09581c3..f93d7ba 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -74,6 +74,7 @@ namespace OpenSim.Region.Physics.OdePlugin private bool _zeroFlag = false; private bool m_lastUpdateSent = false; private Vector3 _velocity; + private Vector3 m_taintTargetVelocity; private Vector3 _target_velocity; private Vector3 _acceleration; private Vector3 m_rotationalVelocity; @@ -701,7 +702,7 @@ namespace OpenSim.Region.Physics.OdePlugin // d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); // d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); // //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); -// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); +// //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyFArotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); // } public override Vector3 Force @@ -767,14 +768,15 @@ namespace OpenSim.Region.Physics.OdePlugin if (value.IsFinite()) { m_pidControllerActive = true; - _target_velocity = value; + m_taintTargetVelocity = value; + _parent_scene.AddPhysicsActorTaint(this); } else { m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character"); } -// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", _target_velocity); +// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", m_taintTargetVelocity); } } @@ -834,14 +836,14 @@ namespace OpenSim.Region.Physics.OdePlugin // If uncommented, things get pushed off world // // m_log.Debug("Push!"); - // _target_velocity.X += force.X; - // _target_velocity.Y += force.Y; - // _target_velocity.Z += force.Z; + // m_taintTargetVelocity.X += force.X; + // m_taintTargetVelocity.Y += force.Y; + // m_taintTargetVelocity.Z += force.Z; } else { m_pidControllerActive = true; - _target_velocity += force; + m_taintTargetVelocity += force; } } else @@ -1248,6 +1250,9 @@ namespace OpenSim.Region.Physics.OdePlugin } } + if (m_taintTargetVelocity != _target_velocity) + _target_velocity = m_taintTargetVelocity; + if (m_tainted_isPhysical != m_isPhysical) { if (m_tainted_isPhysical) -- cgit v1.1