aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin
diff options
context:
space:
mode:
authorUbitUmarov2012-05-12 14:00:08 +0100
committerUbitUmarov2012-05-12 14:00:08 +0100
commit4d98a291a2d1440afd8f7375d14842fd91d8083f (patch)
tree835ac6c8c22ac11df5186e2920bf7427888ade48 /OpenSim/Region/Physics/UbitOdePlugin
parent ubitODE reduced again a bit the max allowed correction velocity on colisions... (diff)
downloadopensim-SC_OLD-4d98a291a2d1440afd8f7375d14842fd91d8083f.zip
opensim-SC_OLD-4d98a291a2d1440afd8f7375d14842fd91d8083f.tar.gz
opensim-SC_OLD-4d98a291a2d1440afd8f7375d14842fd91d8083f.tar.bz2
opensim-SC_OLD-4d98a291a2d1440afd8f7375d14842fd91d8083f.tar.xz
ubitODE let vehicles responde faster to changes of some parameters like motors decay times
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs25
1 files changed, 13 insertions, 12 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
index e88e559..56d0f1a 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
@@ -63,6 +63,9 @@ namespace OpenSim.Region.Physics.OdePlugin
63 private OdeScene _pParentScene; 63 private OdeScene _pParentScene;
64 64
65 // Vehicle properties 65 // Vehicle properties
66 // WARNING this are working copies for internel use
67 // their values may not be the corresponding parameter
68
66 private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier 69 private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier
67 private Quaternion m_RollreferenceFrame = Quaternion.Identity; // what hell is this ? 70 private Quaternion m_RollreferenceFrame = Quaternion.Identity; // what hell is this ?
68 71
@@ -244,6 +247,7 @@ namespace OpenSim.Region.Physics.OdePlugin
244 if (pValue < m_timestep) pValue = m_timestep; 247 if (pValue < m_timestep) pValue = m_timestep;
245 else if (pValue > 120) pValue = 120; 248 else if (pValue > 120) pValue = 120;
246 m_angularMotorDecayTimescale = pValue * m_invtimestep; 249 m_angularMotorDecayTimescale = pValue * m_invtimestep;
250 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
247 break; 251 break;
248 case Vehicle.ANGULAR_MOTOR_TIMESCALE: 252 case Vehicle.ANGULAR_MOTOR_TIMESCALE:
249 if (pValue < m_timestep) pValue = m_timestep; 253 if (pValue < m_timestep) pValue = m_timestep;
@@ -293,6 +297,7 @@ namespace OpenSim.Region.Physics.OdePlugin
293 if (pValue < m_timestep) pValue = m_timestep; 297 if (pValue < m_timestep) pValue = m_timestep;
294 else if (pValue > 120) pValue = 120; 298 else if (pValue > 120) pValue = 120;
295 m_linearMotorDecayTimescale = (0.2f +pValue) * m_invtimestep; 299 m_linearMotorDecayTimescale = (0.2f +pValue) * m_invtimestep;
300 m_lmDecay = (1.0f - 1.0f / m_linearMotorDecayTimescale);
296 break; 301 break;
297 case Vehicle.LINEAR_MOTOR_TIMESCALE: 302 case Vehicle.LINEAR_MOTOR_TIMESCALE:
298 if (pValue < m_timestep) pValue = m_timestep; 303 if (pValue < m_timestep) pValue = m_timestep;
@@ -320,7 +325,7 @@ namespace OpenSim.Region.Physics.OdePlugin
320 if (len > 12.566f) 325 if (len > 12.566f)
321 m_angularMotorDirection *= (12.566f / len); 326 m_angularMotorDirection *= (12.566f / len);
322 327
323 m_amEfect = 1.0f / m_angularMotorTimescale; // turn it on 328 m_amEfect = 1.0f ; // turn it on
324 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale; 329 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
325 330
326 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 331 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
@@ -338,7 +343,7 @@ namespace OpenSim.Region.Physics.OdePlugin
338 m_linearMotorDirection *= (100.0f / len); 343 m_linearMotorDirection *= (100.0f / len);
339 344
340 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale; 345 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale;
341 m_lmEfect = 1.0f / m_linearMotorTimescale; // turn it on 346 m_lmEfect = 1.0f; // turn it on
342 347
343 m_ffactor = 0.01f; 348 m_ffactor = 0.01f;
344 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 349 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
@@ -374,7 +379,7 @@ namespace OpenSim.Region.Physics.OdePlugin
374 if (len > 12.566f) 379 if (len > 12.566f)
375 m_angularMotorDirection *= (12.566f / len); 380 m_angularMotorDirection *= (12.566f / len);
376 381
377 m_amEfect = 1.0f / m_angularMotorTimescale; // turn it on 382 m_amEfect = 1.0f; // turn it on
378 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale; 383 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
379 384
380 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 385 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
@@ -393,11 +398,9 @@ namespace OpenSim.Region.Physics.OdePlugin
393 if (len > 100.0f) 398 if (len > 100.0f)
394 m_linearMotorDirection *= (100.0f / len); 399 m_linearMotorDirection *= (100.0f / len);
395 400
396 m_lmEfect = 1.0f / m_linearMotorTimescale; // turn it on 401 m_lmEfect = 1.0f; // turn it on
397 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale; 402 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale;
398 403
399
400
401 m_ffactor = 0.01f; 404 m_ffactor = 0.01f;
402 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 405 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
403 && !rootPrim.m_isSelected && !rootPrim.m_disabled) 406 && !rootPrim.m_isSelected && !rootPrim.m_disabled)
@@ -776,10 +779,10 @@ namespace OpenSim.Region.Physics.OdePlugin
776 float ldampZ = 0; 779 float ldampZ = 0;
777 780
778 // linear motor 781 // linear motor
779 if (m_lmEfect > 0.001 && m_linearMotorTimescale < 1000) 782 if (m_lmEfect > 0.01 && m_linearMotorTimescale < 1000)
780 { 783 {
781 tmpV = m_linearMotorDirection - curLocalVel; // velocity error 784 tmpV = m_linearMotorDirection - curLocalVel; // velocity error
782 tmpV *= m_lmEfect; // error to correct in this timestep 785 tmpV *= m_lmEfect / m_linearMotorTimescale; // error to correct in this timestep
783 tmpV *= rotq; // to world 786 tmpV *= rotq; // to world
784 787
785 if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0) 788 if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0)
@@ -799,9 +802,7 @@ namespace OpenSim.Region.Physics.OdePlugin
799 } 802 }
800 803
801 m_lmEfect *= m_lmDecay; 804 m_lmEfect *= m_lmDecay;
802 805 m_ffactor = 0.01f + 1e-4f * curVel.LengthSquared();
803 // m_ffactor = 0.01f + 1e-4f * curVel.LengthSquared();
804 m_ffactor = 0;
805 } 806 }
806 else 807 else
807 { 808 {
@@ -1007,7 +1008,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1007 if (m_amEfect > 0.01 && m_angularMotorTimescale < 1000) 1008 if (m_amEfect > 0.01 && m_angularMotorTimescale < 1000)
1008 { 1009 {
1009 tmpV = m_angularMotorDirection - curLocalAngVel; // velocity error 1010 tmpV = m_angularMotorDirection - curLocalAngVel; // velocity error
1010 tmpV *= m_amEfect; // error to correct in this timestep 1011 tmpV *= m_amEfect / m_angularMotorTimescale; // error to correct in this timestep
1011 torque.X += tmpV.X * m_ampwr; 1012 torque.X += tmpV.X * m_ampwr;
1012 torque.Y += tmpV.Y * m_ampwr; 1013 torque.Y += tmpV.Y * m_ampwr;
1013 torque.Z += tmpV.Z; 1014 torque.Z += tmpV.Z;