diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index a41c856..6efa4d1 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -2395,15 +2395,15 @@ Console.WriteLine(" JointCreateFixed"); | |||
2395 | { | 2395 | { |
2396 | get | 2396 | get |
2397 | { | 2397 | { |
2398 | // Averate previous velocity with the new one so | 2398 | // Average previous velocity with the new one so |
2399 | // client object interpolation works a 'little' better | 2399 | // client object interpolation works a 'little' better |
2400 | if (_zeroFlag) | 2400 | if (_zeroFlag) |
2401 | return Vector3.Zero; | 2401 | return Vector3.Zero; |
2402 | 2402 | ||
2403 | Vector3 returnVelocity = Vector3.Zero; | 2403 | Vector3 returnVelocity = Vector3.Zero; |
2404 | returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; | 2404 | returnVelocity.X = (m_lastVelocity.X + _velocity.X) * 0.5f; // 0.5f is mathematically equiv to '/ 2' |
2405 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2; | 2405 | returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y) * 0.5f; |
2406 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; | 2406 | returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z) * 0.5f; |
2407 | return returnVelocity; | 2407 | return returnVelocity; |
2408 | } | 2408 | } |
2409 | set | 2409 | set |
@@ -2600,6 +2600,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2600 | { | 2600 | { |
2601 | Vector3 pv = Vector3.Zero; | 2601 | Vector3 pv = Vector3.Zero; |
2602 | bool lastZeroFlag = _zeroFlag; | 2602 | bool lastZeroFlag = _zeroFlag; |
2603 | float m_minvelocity = 0; | ||
2603 | if (Body != (IntPtr)0) // FIXME -> or if it is a joint | 2604 | if (Body != (IntPtr)0) // FIXME -> or if it is a joint |
2604 | { | 2605 | { |
2605 | d.Vector3 vec = d.BodyGetPosition(Body); | 2606 | d.Vector3 vec = d.BodyGetPosition(Body); |
@@ -2752,8 +2753,21 @@ Console.WriteLine(" JointCreateFixed"); | |||
2752 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); | 2753 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); |
2753 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); | 2754 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); |
2754 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); | 2755 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); |
2756 | |||
2757 | // Note here that linearvelocity is affecting angular velocity... so I'm guessing this is a vehicle specific thing... | ||
2758 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. | ||
2759 | // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles | ||
2760 | // adding these logical exclusion situations to maintain this where I think it was intended to be. | ||
2761 | if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) | ||
2762 | { | ||
2763 | m_minvelocity = 0.5f; | ||
2764 | } | ||
2765 | else | ||
2766 | { | ||
2767 | m_minvelocity = 0.02f; | ||
2768 | } | ||
2755 | 2769 | ||
2756 | if (_velocity.ApproxEquals(pv, 0.5f)) | 2770 | if (_velocity.ApproxEquals(pv, m_minvelocity)) |
2757 | { | 2771 | { |
2758 | m_rotationalVelocity = pv; | 2772 | m_rotationalVelocity = pv; |
2759 | } | 2773 | } |