diff options
author | Justin Clark-Casey (justincc) | 2011-10-29 02:30:33 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-29 02:30:33 +0100 |
commit | 9fdd1753fa535ea710afc18753529aa3d12a09c6 (patch) | |
tree | a21fcfdec05a3ce9cec29d44c9012e02806d6c54 /OpenSim/Region/Physics | |
parent | tidy up OdeCharacter so that we just use OpenMetaverse.Vector3 assignment dir... (diff) | |
download | opensim-SC-9fdd1753fa535ea710afc18753529aa3d12a09c6.zip opensim-SC-9fdd1753fa535ea710afc18753529aa3d12a09c6.tar.gz opensim-SC-9fdd1753fa535ea710afc18753529aa3d12a09c6.tar.bz2 opensim-SC-9fdd1753fa535ea710afc18753529aa3d12a09c6.tar.xz |
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
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 19 |
1 files changed, 12 insertions, 7 deletions
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 | |||
74 | private bool _zeroFlag = false; | 74 | private bool _zeroFlag = false; |
75 | private bool m_lastUpdateSent = false; | 75 | private bool m_lastUpdateSent = false; |
76 | private Vector3 _velocity; | 76 | private Vector3 _velocity; |
77 | private Vector3 m_taintTargetVelocity; | ||
77 | private Vector3 _target_velocity; | 78 | private Vector3 _target_velocity; |
78 | private Vector3 _acceleration; | 79 | private Vector3 _acceleration; |
79 | private Vector3 m_rotationalVelocity; | 80 | private Vector3 m_rotationalVelocity; |
@@ -701,7 +702,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
701 | // d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); | 702 | // d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, servo, 0.0f, 0.0f, 1.0f); |
702 | // d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); | 703 | // d.BodyAddForceAtRelPos(Body, 0.0f, 0.0f, -servo, 0.0f, 0.0f, -1.0f); |
703 | // //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); | 704 | // //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); |
704 | // //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); | 705 | // //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyFArotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); |
705 | // } | 706 | // } |
706 | 707 | ||
707 | public override Vector3 Force | 708 | public override Vector3 Force |
@@ -767,14 +768,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
767 | if (value.IsFinite()) | 768 | if (value.IsFinite()) |
768 | { | 769 | { |
769 | m_pidControllerActive = true; | 770 | m_pidControllerActive = true; |
770 | _target_velocity = value; | 771 | m_taintTargetVelocity = value; |
772 | _parent_scene.AddPhysicsActorTaint(this); | ||
771 | } | 773 | } |
772 | else | 774 | else |
773 | { | 775 | { |
774 | m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character"); | 776 | m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character"); |
775 | } | 777 | } |
776 | 778 | ||
777 | // m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", _target_velocity); | 779 | // m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", m_taintTargetVelocity); |
778 | } | 780 | } |
779 | } | 781 | } |
780 | 782 | ||
@@ -834,14 +836,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
834 | // If uncommented, things get pushed off world | 836 | // If uncommented, things get pushed off world |
835 | // | 837 | // |
836 | // m_log.Debug("Push!"); | 838 | // m_log.Debug("Push!"); |
837 | // _target_velocity.X += force.X; | 839 | // m_taintTargetVelocity.X += force.X; |
838 | // _target_velocity.Y += force.Y; | 840 | // m_taintTargetVelocity.Y += force.Y; |
839 | // _target_velocity.Z += force.Z; | 841 | // m_taintTargetVelocity.Z += force.Z; |
840 | } | 842 | } |
841 | else | 843 | else |
842 | { | 844 | { |
843 | m_pidControllerActive = true; | 845 | m_pidControllerActive = true; |
844 | _target_velocity += force; | 846 | m_taintTargetVelocity += force; |
845 | } | 847 | } |
846 | } | 848 | } |
847 | else | 849 | else |
@@ -1248,6 +1250,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1248 | } | 1250 | } |
1249 | } | 1251 | } |
1250 | 1252 | ||
1253 | if (m_taintTargetVelocity != _target_velocity) | ||
1254 | _target_velocity = m_taintTargetVelocity; | ||
1255 | |||
1251 | if (m_tainted_isPhysical != m_isPhysical) | 1256 | if (m_tainted_isPhysical != m_isPhysical) |
1252 | { | 1257 | { |
1253 | if (m_tainted_isPhysical) | 1258 | if (m_tainted_isPhysical) |