From 185d3bd39eb371c769c9e0958f5e143a1e5c9a47 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 8 Nov 2015 01:47:54 +0000 Subject: change maximum angular velocity to a value derived from heartbeat rate and Nyquist. --- OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs | 8 +++----- 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 d.BodySetAutoDisableSteps(Body, body_autodisable_frames); d.BodySetAutoDisableAngularThreshold(Body, 0.05f); d.BodySetAutoDisableLinearThreshold(Body, 0.05f); - d.BodySetDamping(Body, .008f, .005f); + d.BodySetDamping(Body, .004f, .001f); if (m_targetSpace != IntPtr.Zero) { @@ -2070,8 +2070,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde _mass = objdmass.mass; } - - private void FixInertia(Vector3 NewPos) { d.Matrix3 primmat = new d.Matrix3(); @@ -3135,9 +3133,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changeangvelocity(Vector3 newAngVel) { float len = newAngVel.LengthSquared(); - if (len > 144.0f) // limit to 12rad/s + if (len > _parent_scene.maxAngVelocitySQ) { - len = 12.0f / (float)Math.Sqrt(len); + len = _parent_scene.maximumAngularVelocity / (float)Math.Sqrt(len); newAngVel *= len; } 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 private float avMovementDivisorRun = 0.8f; private float minimumGroundFlightOffset = 3f; public float maximumMassObject = 10000.01f; - public float geomDefaultDensity = 10.0f; + public float maximumAngularVelocity = 12.0f; // default 12rad/s + public float maxAngVelocitySQ = 144f; // squared value + public float bodyPIDD = 35f; public float bodyPIDG = 25; @@ -493,6 +495,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } + float heartbeat = 1/m_frameWorkScene.MinFrameTime; + maximumAngularVelocity = 0.49f * heartbeat *(float)Math.PI; + maxAngVelocitySQ = maximumAngularVelocity * maximumAngularVelocity; + d.WorldSetCFM(world, comumContactCFM); d.WorldSetERP(world, comumContactERP); @@ -502,7 +508,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde d.WorldSetAngularDamping(world, 0.002f); d.WorldSetAngularDampingThreshold(world, 0f); d.WorldSetLinearDampingThreshold(world, 0f); - d.WorldSetMaxAngularSpeed(world, 100f); + d.WorldSetMaxAngularSpeed(world, maximumAngularVelocity); d.WorldSetQuickStepNumIterations(world, m_physicsiterations); -- cgit v1.1