From 6e01769bcff35be9cace62a0342cf2d275608891 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 12 Feb 2008 04:27:20 +0000 Subject: * A bunch of updates to make things more smooth. ** Sending the actual TimeDilation to the client now instead of the 62455 constant. The client is *supposed* to use that value to sync with the simulator. (actually sending ushort.maxvalue * TimeDilation) ** Disabling prim that inter-penetrate instead of just not attaching a joint ** Reduced prim spin a 'little' bit, but not *enough* ** Tweaked the TimeDilation algorithm to be closer to 1.0 by default and various changes to the sim stats reporter ** Created a .SetValues method to PhysicsVector so we can simply call the setvalues function instead of .x, .y, .z sets. ** Experimented with a .GetBytes Method on PhysicsActor to be able to use the LLVector3.FromBytes() method. ** Upped the Inter-penetration depth to 0.25 instead of .08. --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 40 +++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 12d7694..819d823 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -53,6 +53,7 @@ namespace OpenSim.Region.Physics.OdePlugin private bool m_taintshape = false; private bool m_taintPhysics = false; public bool m_taintremove = false; + public bool m_taintdisable = false; private bool m_taintforce = false; private List m_forcelist = new List(); @@ -451,6 +452,9 @@ namespace OpenSim.Region.Physics.OdePlugin if (m_taintforce) changeAddForce(timestep); + + if (m_taintdisable) + changedisable(timestep); } public void Move(float timestep) @@ -494,6 +498,13 @@ namespace OpenSim.Region.Physics.OdePlugin m_taintrot = _orientation; } + public void changedisable(float timestep) + { + if (Body != (IntPtr) 0) + d.BodyDisable(Body); + + m_taintdisable = false; + } public void changePhysicsStatus(float timestap) { @@ -862,7 +873,16 @@ namespace OpenSim.Region.Physics.OdePlugin public override PhysicsVector RotationalVelocity { - get { return m_rotationalVelocity; } + get { + if (_zeroFlag) + return PhysicsVector.Zero; + m_lastUpdateSent = false; + + if (m_rotationalVelocity.IsIdentical(PhysicsVector.Zero, 0.2f)) + return PhysicsVector.Zero; + + return m_rotationalVelocity; + } set { m_rotationalVelocity = value; } } @@ -917,6 +937,7 @@ namespace OpenSim.Region.Physics.OdePlugin && (Math.Abs(m_lastposition.Z - l_position.Z) < 0.02)) { _zeroFlag = true; + m_throttleUpdates = false; } else { @@ -944,9 +965,7 @@ namespace OpenSim.Region.Physics.OdePlugin { m_throttleUpdates = false; throttleCounter = 0; - m_rotationalVelocity.X = 0; - m_rotationalVelocity.Y = 0; - m_rotationalVelocity.Z = 0; + m_rotationalVelocity = PhysicsVector.Zero; base.RequestPhysicsterseUpdate(); m_lastUpdateSent = true; } @@ -960,10 +979,15 @@ namespace OpenSim.Region.Physics.OdePlugin _velocity.X = vel.X; _velocity.Y = vel.Y; _velocity.Z = vel.Z; - - m_rotationalVelocity.X = rotvel.X; - m_rotationalVelocity.Y = rotvel.Y; - m_rotationalVelocity.Z = rotvel.Z; + if (_velocity.IsIdentical(PhysicsVector.Zero, 0.5f)) + { + m_rotationalVelocity = PhysicsVector.Zero; + } + else + { + m_rotationalVelocity.setValues(rotvel.X, rotvel.Y, rotvel.Z); + } + //System.Console.WriteLine("ODE: " + m_rotationalVelocity.ToString()); _orientation.w = ori.W; _orientation.x = ori.X; -- cgit v1.1