From 19e0ada93af347cff93a3950f66abe245399f8b2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 17 Feb 2008 10:41:08 +0000 Subject: * Located and destroyed the weird velocity and rotation transfers. It turned out to be that the Static PhysicsVector.Zero was transferring velocities between all non fixed objects. Not so static after all :(. Finding it was cruel and unusual punishment from the CLR. * Therefore, when you run through a pile of prim you won't see things rotate when they're not supposed to anymore. * Avatars don't float off either. --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 10 ++++++++-- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 20 +++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin') diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 6b8d0e2..0f1446c 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -317,6 +317,11 @@ namespace OpenSim.Region.Physics.OdePlugin m_pidControllerActive = status; } + public override bool Stopped + { + get { return _zeroFlag; } + } + /// /// This 'puts' an avatar somewhere in the physics space. /// Not really a good choice unless you 'know' it's a good @@ -509,8 +514,9 @@ namespace OpenSim.Region.Physics.OdePlugin public override PhysicsVector Velocity { get { + // There's a problem with PhysicsVector.Zero! Don't Use it Here! if (_zeroFlag) - return PhysicsVector.Zero; + return new PhysicsVector(0f, 0f, 0f); m_lastUpdateSent = false; return _velocity; } @@ -756,7 +762,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (!m_lastUpdateSent) { m_lastUpdateSent = true; - base.RequestPhysicsterseUpdate(); + //base.RequestPhysicsterseUpdate(); } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index fae5316..b41153b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -1129,6 +1129,11 @@ namespace OpenSim.Region.Physics.OdePlugin set { m_throttleUpdates = value; } } + public override bool Stopped + { + get { return _zeroFlag; } + } + public override PhysicsVector Position { get { return _position; } @@ -1233,12 +1238,13 @@ namespace OpenSim.Region.Physics.OdePlugin public override PhysicsVector RotationalVelocity { get { + PhysicsVector pv = new PhysicsVector(0, 0, 0); if (_zeroFlag) - return PhysicsVector.Zero; + return pv; m_lastUpdateSent = false; - if (m_rotationalVelocity.IsIdentical(PhysicsVector.Zero, 0.2f)) - return PhysicsVector.Zero; + if (m_rotationalVelocity.IsIdentical(pv, 0.2f)) + return pv; return m_rotationalVelocity; } @@ -1261,7 +1267,7 @@ 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); if (Body != (IntPtr) 0) { d.Vector3 vec = d.BodyGetPosition(Body); @@ -1348,7 +1354,7 @@ namespace OpenSim.Region.Physics.OdePlugin { m_throttleUpdates = false; throttleCounter = 0; - m_rotationalVelocity = PhysicsVector.Zero; + m_rotationalVelocity = pv; base.RequestPhysicsterseUpdate(); m_lastUpdateSent = true; } @@ -1362,9 +1368,9 @@ namespace OpenSim.Region.Physics.OdePlugin _velocity.X = vel.X; _velocity.Y = vel.Y; _velocity.Z = vel.Z; - if (_velocity.IsIdentical(PhysicsVector.Zero, 0.5f)) + if (_velocity.IsIdentical(pv, 0.5f)) { - m_rotationalVelocity = PhysicsVector.Zero; + m_rotationalVelocity = pv; } else { -- cgit v1.1