diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 95a4134..6ff8a48 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -805,6 +805,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
805 | // m_angularFrictionTimescale // body angular velocity decay rate | 805 | // m_angularFrictionTimescale // body angular velocity decay rate |
806 | // m_lastAngularVelocity // what was last applied to body | 806 | // m_lastAngularVelocity // what was last applied to body |
807 | 807 | ||
808 | /* | ||
808 | if (m_angularMotorDirection.LengthSquared() > 0.0001) | 809 | if (m_angularMotorDirection.LengthSquared() > 0.0001) |
809 | { | 810 | { |
810 | Vector3 origVel = m_angularMotorVelocity; | 811 | Vector3 origVel = m_angularMotorVelocity; |
@@ -823,6 +824,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
823 | { | 824 | { |
824 | m_angularMotorVelocity = Vector3.Zero; | 825 | m_angularMotorVelocity = Vector3.Zero; |
825 | } | 826 | } |
827 | */ | ||
826 | 828 | ||
827 | Vector3 angularMotorContribution = m_angularMotor.Step(pTimestep); | 829 | Vector3 angularMotorContribution = m_angularMotor.Step(pTimestep); |
828 | 830 | ||
@@ -842,15 +844,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
842 | // verticalError.X and .Y are the World error amounts. They are 0 when there is no | 844 | // verticalError.X and .Y are the World error amounts. They are 0 when there is no |
843 | // error (Vehicle Body is 'vertical'), and .Z will be 1. As the body leans to its | 845 | // error (Vehicle Body is 'vertical'), and .Z will be 1. As the body leans to its |
844 | // side |.X| will increase to 1 and .Z fall to 0. As body inverts |.X| will fall | 846 | // side |.X| will increase to 1 and .Z fall to 0. As body inverts |.X| will fall |
845 | // and .Z will go // negative. Similar for tilt and |.Y|. .X and .Y must be | 847 | // and .Z will go negative. Similar for tilt and |.Y|. .X and .Y must be |
846 | // modulated to prevent a stable inverted body. | 848 | // modulated to prevent a stable inverted body. |
847 | 849 | ||
848 | // Error is 0 (no error) to +/- 2 (max error) | 850 | // Error is 0 (no error) to +/- 2 (max error) |
849 | if (verticalError.Z < 0.0f) | 851 | verticalError.X = Math.Max(-2f, Math.Min(verticalError.X, 2f)); |
850 | { | 852 | verticalError.Y = Math.Max(-2f, Math.Min(verticalError.Y, 2f)); |
851 | verticalError.X = 2.0f - verticalError.X; | 853 | |
852 | verticalError.Y = 2.0f - verticalError.Y; | ||
853 | } | ||
854 | // scale it by VAservo (timestep and timescale) | 854 | // scale it by VAservo (timestep and timescale) |
855 | verticalError = verticalError * VAservo; | 855 | verticalError = verticalError * VAservo; |
856 | 856 | ||
@@ -1013,10 +1013,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1013 | // Also remove any motion that is on the object so added motion is only from vehicle. | 1013 | // Also remove any motion that is on the object so added motion is only from vehicle. |
1014 | Vector3 applyAngularForce = ((m_lastAngularVelocity * pTimestep) | 1014 | Vector3 applyAngularForce = ((m_lastAngularVelocity * pTimestep) |
1015 | - Prim.ForceRotationalVelocity); | 1015 | - Prim.ForceRotationalVelocity); |
1016 | // Unscale the force by the angular factor so it overwhelmes the Bullet additions. | ||
1016 | Prim.ForceRotationalVelocity = applyAngularForce; | 1017 | Prim.ForceRotationalVelocity = applyAngularForce; |
1017 | 1018 | ||
1018 | VDetailLog("{0},MoveAngular,done,newRotVel={1},lastAngular={2}", | 1019 | VDetailLog("{0},MoveAngular,done,angMotor={1},vertAttr={2},bank={3},deflect={4},newAngForce={5},lastAngular={6}", |
1019 | Prim.LocalID, applyAngularForce, m_lastAngularVelocity); | 1020 | Prim.LocalID, |
1021 | angularMotorContribution, verticalAttractionContribution, | ||
1022 | bankingContribution, deflectionContribution, | ||
1023 | applyAngularForce, m_lastAngularVelocity | ||
1024 | ); | ||
1020 | } | 1025 | } |
1021 | } | 1026 | } |
1022 | 1027 | ||