From 48134af6162249885740bad80a6b1bbb618bbc6e Mon Sep 17 00:00:00 2001 From: Kitto Flora Date: Wed, 3 Feb 2010 16:20:13 -0500 Subject: Motor angular decay fix. --- OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs index c03e381..4eb3313 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODEDynamics.cs @@ -646,12 +646,15 @@ namespace OpenSim.Region.Physics.OdePlugin //if(frcount == 0) Console.WriteLine("V0 = {0}", angObjectVel); // Vector3 FrAaccel = m_lastAngularVelocity - angObjectVel; // Vector3 initavel = angObjectVel; - // Decay Angular Motor + // Decay Angular Motor 1. In SL this also depends on attack rate! decay ~= 23/Attack. + float atk_decayfactor = 23.0f / (m_angularMotorTimescale * pTimestep); + m_angularMotorDVel -= m_angularMotorDVel / atk_decayfactor; + // Decay Angular Motor 2. if (m_angularMotorDecayTimescale < 300.0f) { - float decayfactor = m_angularMotorDecayTimescale/pTimestep; - Vector3 decayAmount = (m_angularMotorDVel/decayfactor); - m_angularMotorDVel -= decayAmount; + float decayfactor = m_angularMotorDecayTimescale/pTimestep; // df = Dec / pts + Vector3 decayAmount = (m_angularMotorDVel/decayfactor); // v-da = v-Dvel / df = v-Dvel * pts / Dec + m_angularMotorDVel -= decayAmount; // v-Dvel = v-Dvel - (v-Dvel / df = v-Dvel * pts / Dec) if (m_angularMotorDVel.ApproxEquals(Vector3.Zero, 0.01f)) { -- cgit v1.1