* 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.
ThreadPoolClientBranch
Teravus Ovares 2008-02-17 10:41:08 +00:00
parent 58c72c409d
commit 19e0ada93a
9 changed files with 76 additions and 14 deletions

View File

@ -78,6 +78,9 @@ namespace OpenSim.Region.Environment.Scenes
private bool m_newCoarseLocations = true;
private bool m_gotAllObjectsInScene = false;
private bool m_lastPhysicsStoppedStatus = false;
private LLVector3 m_lastVelocity = LLVector3.Zero;
// Default AV Height
private float m_avHeight = 127.0f;
@ -1263,11 +1266,17 @@ namespace OpenSim.Region.Environment.Scenes
m_updateCount = 0;
}
}
else if (Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) // physics-related movement
else if ((Util.GetDistanceTo(lastPhysPos, AbsolutePosition) > 0.02) || (Util.GetDistanceTo(m_lastVelocity, m_velocity) > 0.02)) // physics-related movement
{
// Send Terse Update to all clients updates lastPhysPos and m_lastVelocity
// doing the above assures us that we know what we sent the clients last
SendTerseUpdateToAllClients();
m_updateCount = 0;
lastPhysPos = AbsolutePosition;
}
// followed suggestion from mic bowman. reversed the two lines below.
@ -1308,6 +1317,9 @@ namespace OpenSim.Region.Environment.Scenes
m_scene.Broadcast(SendTerseUpdateToClient);
m_lastVelocity = m_velocity;
lastPhysPos = AbsolutePosition;
m_scene.AddAgentTime(System.Environment.TickCount - m_perfMonMS);
}
@ -1729,7 +1741,7 @@ namespace OpenSim.Region.Environment.Scenes
AbsolutePosition.Z);
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec);
m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
}

View File

@ -274,6 +274,12 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
set { return; }
}
public override bool Stopped
{
get { return false; }
}
public override PhysicsVector Position
{
get { return _position; }

View File

@ -730,6 +730,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
_name = name;
}
public override bool Stopped
{
get { return false; }
}
public override PhysicsVector Position
{
get { return _position; }

View File

@ -35,7 +35,7 @@ namespace OpenSim.Region.Physics.Manager
public class CollisionLocker
{
private bool locked = false;
private List<IntPtr> worldlock = new List<IntPtr>();
public CollisionLocker()
{

View File

@ -118,6 +118,8 @@ namespace OpenSim.Region.Physics.Manager
get { return new NullPhysicsActor(); }
}
public abstract bool Stopped { get; }
public abstract PhysicsVector Size { get; set; }
public abstract PrimitiveBaseShape Shape { set; }
@ -204,6 +206,11 @@ namespace OpenSim.Region.Physics.Manager
public class NullPhysicsActor : PhysicsActor
{
public override bool Stopped
{
get{ return false; }
}
public override PhysicsVector Position
{
get { return PhysicsVector.Zero; }

View File

@ -317,6 +317,11 @@ namespace OpenSim.Region.Physics.OdePlugin
m_pidControllerActive = status;
}
public override bool Stopped
{
get { return _zeroFlag; }
}
/// <summary>
/// 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();
}
}

View File

@ -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
{

View File

@ -403,6 +403,11 @@ namespace OpenSim.Region.Physics.POSPlugin
set { return; }
}
public override bool Stopped
{
get { return false; }
}
public override PhysicsVector Position
{
get { return _position; }
@ -545,6 +550,11 @@ namespace OpenSim.Region.Physics.POSPlugin
set { return; }
}
public override bool Stopped
{
get { return false; }
}
public override PhysicsVector Position
{
get { return _position; }

View File

@ -279,6 +279,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
set { m_rotationalVelocity = value; }
}
public override bool Stopped
{
get { return false; }
}
public override PhysicsVector Position
{
get { return _position; }
@ -479,6 +484,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
set { return; }
}
public override bool Stopped
{
get { return false; }
}
public override PhysicsVector Position
{
get