aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs19
1 files changed, 13 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
index 0fabb56..d0b4546 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
@@ -119,25 +119,22 @@ namespace OpenSim.Region.Physics.OdePlugin
119 // auxiliar 119 // auxiliar
120 private float m_lmEfect = 0; // current linear motor eficiency 120 private float m_lmEfect = 0; // current linear motor eficiency
121 private float m_amEfect = 0; // current angular motor eficiency 121 private float m_amEfect = 0; // current angular motor eficiency
122 private float m_ffactor = 1.0f;
122 123
123 public bool EngineActive 124 public float FrictionFactor
124 { 125 {
125 get 126 get
126 { 127 {
127 if (m_lmEfect > 0.01) 128 return m_ffactor;
128 return true;
129 return false;
130 } 129 }
131 } 130 }
132 131
133
134 public ODEDynamics(OdePrim rootp) 132 public ODEDynamics(OdePrim rootp)
135 { 133 {
136 rootPrim = rootp; 134 rootPrim = rootp;
137 _pParentScene = rootPrim._parent_scene; 135 _pParentScene = rootPrim._parent_scene;
138 } 136 }
139 137
140
141 public void DoSetVehicle(VehicleData vd) 138 public void DoSetVehicle(VehicleData vd)
142 { 139 {
143 140
@@ -212,6 +209,7 @@ namespace OpenSim.Region.Physics.OdePlugin
212 209
213 m_lmEfect = 0; 210 m_lmEfect = 0;
214 m_amEfect = 0; 211 m_amEfect = 0;
212 m_ffactor = 1.0f;
215 } 213 }
216 214
217 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) 215 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
@@ -329,6 +327,7 @@ namespace OpenSim.Region.Physics.OdePlugin
329 if (len > 30.0f) 327 if (len > 30.0f)
330 m_linearMotorDirection *= (30.0f / len); 328 m_linearMotorDirection *= (30.0f / len);
331 m_lmEfect = 1.0f; // turn it on 329 m_lmEfect = 1.0f; // turn it on
330 m_ffactor = 0.01f;
332 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 331 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
333 && !rootPrim.m_isSelected && !rootPrim.m_disabled) 332 && !rootPrim.m_isSelected && !rootPrim.m_disabled)
334 d.BodyEnable(rootPrim.Body); 333 d.BodyEnable(rootPrim.Body);
@@ -379,6 +378,7 @@ namespace OpenSim.Region.Physics.OdePlugin
379 if (len > 30.0f) 378 if (len > 30.0f)
380 m_linearMotorDirection *= (30.0f / len); 379 m_linearMotorDirection *= (30.0f / len);
381 m_lmEfect = 1.0f; // turn it on 380 m_lmEfect = 1.0f; // turn it on
381 m_ffactor = 0.01f;
382 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 382 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
383 && !rootPrim.m_isSelected && !rootPrim.m_disabled) 383 && !rootPrim.m_isSelected && !rootPrim.m_disabled)
384 d.BodyEnable(rootPrim.Body); 384 d.BodyEnable(rootPrim.Body);
@@ -425,6 +425,7 @@ namespace OpenSim.Region.Physics.OdePlugin
425 float invtimestep = _pParentScene.ODE_STEPSIZE; 425 float invtimestep = _pParentScene.ODE_STEPSIZE;
426 m_lmEfect = 0; 426 m_lmEfect = 0;
427 m_amEfect = 0; 427 m_amEfect = 0;
428 m_ffactor = 1f;
428 429
429 m_linearMotorDirection = Vector3.Zero; 430 m_linearMotorDirection = Vector3.Zero;
430 m_angularMotorDirection = Vector3.Zero; 431 m_angularMotorDirection = Vector3.Zero;
@@ -602,6 +603,7 @@ namespace OpenSim.Region.Physics.OdePlugin
602 { 603 {
603 m_lmEfect = 0; 604 m_lmEfect = 0;
604 m_amEfect = 0; 605 m_amEfect = 0;
606 m_ffactor = 1f;
605 } 607 }
606 608
607 public static Vector3 Xrot(Quaternion rot) 609 public static Vector3 Xrot(Quaternion rot)
@@ -752,9 +754,14 @@ namespace OpenSim.Region.Physics.OdePlugin
752 force.Z += tmpV.Z; 754 force.Z += tmpV.Z;
753 } 755 }
754 m_lmEfect *= (1.0f - 1.0f / m_linearMotorDecayTimescale); 756 m_lmEfect *= (1.0f - 1.0f / m_linearMotorDecayTimescale);
757
758 m_ffactor = 0.01f + 1e-4f * curVel.LengthSquared();
755 } 759 }
756 else 760 else
761 {
757 m_lmEfect = 0; 762 m_lmEfect = 0;
763 m_ffactor = 1f;
764 }
758 765
759 // friction 766 // friction
760 if (curLocalVel.X != 0 || curLocalVel.Y != 0 || curLocalVel.Z != 0) 767 if (curLocalVel.X != 0 || curLocalVel.Y != 0 || curLocalVel.Z != 0)