From bbb8b66908a72632324c0b2aefbe2ce5e2c710c2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 23 Feb 2008 12:46:23 +0000 Subject: [PATCH] * Made Physics updates a teensy bit more responsive. A previous CPU optimization of mine slowed the speed of updates using the 'poll' method in certain circumstances. --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 50df7457f7..05dcd7a312 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -1447,9 +1447,10 @@ namespace OpenSim.Region.Physics.OdePlugin } } public void UpdatePositionAndVelocity() - { + { // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! PhysicsVector pv = new PhysicsVector(0, 0, 0); + bool lastZeroFlag = _zeroFlag; if (Body != (IntPtr) 0) { d.Vector3 vec = d.BodyGetPosition(Body); @@ -1546,6 +1547,9 @@ namespace OpenSim.Region.Physics.OdePlugin } else { + if (lastZeroFlag != _zeroFlag) + base.RequestPhysicsterseUpdate(); + m_lastVelocity = _velocity; _position = l_position;