change maximum angular velocity to a value derived from heartbeat rate and Nyquist.

avinationmerge
UbitUmarov 2015-11-08 01:47:54 +00:00
parent eccc6f1081
commit 185d3bd39e
2 changed files with 11 additions and 7 deletions

View File

@ -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;
}

View File

@ -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);