diff options
author | UbitUmarov | 2015-11-08 01:47:54 +0000 |
---|---|---|
committer | UbitUmarov | 2015-11-08 01:47:54 +0000 |
commit | 185d3bd39eb371c769c9e0958f5e143a1e5c9a47 (patch) | |
tree | d22a8d2c0712239c41eddf6d6edeaad4cb7300b1 | |
parent | fix wrong condition to set low angular velocity as Zero. (diff) | |
download | opensim-SC-185d3bd39eb371c769c9e0958f5e143a1e5c9a47.zip opensim-SC-185d3bd39eb371c769c9e0958f5e143a1e5c9a47.tar.gz opensim-SC-185d3bd39eb371c769c9e0958f5e143a1e5c9a47.tar.bz2 opensim-SC-185d3bd39eb371c769c9e0958f5e143a1e5c9a47.tar.xz |
change maximum angular velocity to a value derived from heartbeat rate and Nyquist.
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 10 |
2 files changed, 11 insertions, 7 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index 2752449..1dbf164 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | |||
@@ -1806,7 +1806,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1806 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); | 1806 | d.BodySetAutoDisableSteps(Body, body_autodisable_frames); |
1807 | d.BodySetAutoDisableAngularThreshold(Body, 0.05f); | 1807 | d.BodySetAutoDisableAngularThreshold(Body, 0.05f); |
1808 | d.BodySetAutoDisableLinearThreshold(Body, 0.05f); | 1808 | d.BodySetAutoDisableLinearThreshold(Body, 0.05f); |
1809 | d.BodySetDamping(Body, .008f, .005f); | 1809 | d.BodySetDamping(Body, .004f, .001f); |
1810 | 1810 | ||
1811 | if (m_targetSpace != IntPtr.Zero) | 1811 | if (m_targetSpace != IntPtr.Zero) |
1812 | { | 1812 | { |
@@ -2070,8 +2070,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
2070 | _mass = objdmass.mass; | 2070 | _mass = objdmass.mass; |
2071 | } | 2071 | } |
2072 | 2072 | ||
2073 | |||
2074 | |||
2075 | private void FixInertia(Vector3 NewPos) | 2073 | private void FixInertia(Vector3 NewPos) |
2076 | { | 2074 | { |
2077 | d.Matrix3 primmat = new d.Matrix3(); | 2075 | d.Matrix3 primmat = new d.Matrix3(); |
@@ -3135,9 +3133,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
3135 | private void changeangvelocity(Vector3 newAngVel) | 3133 | private void changeangvelocity(Vector3 newAngVel) |
3136 | { | 3134 | { |
3137 | float len = newAngVel.LengthSquared(); | 3135 | float len = newAngVel.LengthSquared(); |
3138 | if (len > 144.0f) // limit to 12rad/s | 3136 | if (len > _parent_scene.maxAngVelocitySQ) |
3139 | { | 3137 | { |
3140 | len = 12.0f / (float)Math.Sqrt(len); | 3138 | len = _parent_scene.maximumAngularVelocity / (float)Math.Sqrt(len); |
3141 | newAngVel *= len; | 3139 | newAngVel *= len; |
3142 | } | 3140 | } |
3143 | 3141 | ||
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 2da2603..ebffda2 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -216,9 +216,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
216 | private float avMovementDivisorRun = 0.8f; | 216 | private float avMovementDivisorRun = 0.8f; |
217 | private float minimumGroundFlightOffset = 3f; | 217 | private float minimumGroundFlightOffset = 3f; |
218 | public float maximumMassObject = 10000.01f; | 218 | public float maximumMassObject = 10000.01f; |
219 | |||
220 | public float geomDefaultDensity = 10.0f; | 219 | public float geomDefaultDensity = 10.0f; |
221 | 220 | ||
221 | public float maximumAngularVelocity = 12.0f; // default 12rad/s | ||
222 | public float maxAngVelocitySQ = 144f; // squared value | ||
223 | |||
222 | public float bodyPIDD = 35f; | 224 | public float bodyPIDD = 35f; |
223 | public float bodyPIDG = 25; | 225 | public float bodyPIDG = 25; |
224 | 226 | ||
@@ -493,6 +495,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
493 | } | 495 | } |
494 | } | 496 | } |
495 | 497 | ||
498 | float heartbeat = 1/m_frameWorkScene.MinFrameTime; | ||
499 | maximumAngularVelocity = 0.49f * heartbeat *(float)Math.PI; | ||
500 | maxAngVelocitySQ = maximumAngularVelocity * maximumAngularVelocity; | ||
501 | |||
496 | d.WorldSetCFM(world, comumContactCFM); | 502 | d.WorldSetCFM(world, comumContactCFM); |
497 | d.WorldSetERP(world, comumContactERP); | 503 | d.WorldSetERP(world, comumContactERP); |
498 | 504 | ||
@@ -502,7 +508,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
502 | d.WorldSetAngularDamping(world, 0.002f); | 508 | d.WorldSetAngularDamping(world, 0.002f); |
503 | d.WorldSetAngularDampingThreshold(world, 0f); | 509 | d.WorldSetAngularDampingThreshold(world, 0f); |
504 | d.WorldSetLinearDampingThreshold(world, 0f); | 510 | d.WorldSetLinearDampingThreshold(world, 0f); |
505 | d.WorldSetMaxAngularSpeed(world, 100f); | 511 | d.WorldSetMaxAngularSpeed(world, maximumAngularVelocity); |
506 | 512 | ||
507 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | 513 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); |
508 | 514 | ||