* Added an internal throttle on ODE physics updates

* Added a ThrottleUpdates member to PhysicsActor to expose 'throttle' ability to the Scene.
* Updated the ode.dll file with a fix to invalid data passed to ODE's heightfield collision calculator.
afrisby
Teravus Ovares 2007-11-09 21:01:55 +00:00
parent 6c77ae5507
commit e9e72fe907
6 changed files with 56 additions and 5 deletions

View File

@ -201,7 +201,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
get { return false; } get { return false; }
set { return; } set { return; }
} }
public override bool ThrottleUpdates
{
get { return false; }
set { return; }
}
public override bool Flying public override bool Flying
{ {
get { return flying; } get { return flying; }

View File

@ -742,6 +742,11 @@ namespace OpenSim.Region.Physics.BulletXPlugin
get { return flying; } get { return flying; }
set { flying = value; } set { flying = value; }
} }
public override bool ThrottleUpdates
{
get { return false; }
set { return; }
}
public override bool IsColliding public override bool IsColliding
{ {
get { return iscolliding; } get { return iscolliding; }

View File

@ -88,6 +88,8 @@ namespace OpenSim.Region.Physics.Manager
public abstract bool Flying { get; set; } public abstract bool Flying { get; set; }
public abstract bool ThrottleUpdates { get; set; }
public abstract bool IsColliding { get; set; } public abstract bool IsColliding { get; set; }
public abstract PhysicsVector RotationalVelocity { get; set; } public abstract PhysicsVector RotationalVelocity { get; set; }
@ -148,6 +150,11 @@ namespace OpenSim.Region.Physics.Manager
get { return false; } get { return false; }
set { return; } set { return; }
} }
public override bool ThrottleUpdates
{
get { return false; }
set { return; }
}
public override bool IsColliding public override bool IsColliding
{ {

View File

@ -212,6 +212,11 @@ namespace OpenSim.Region.Physics.OdePlugin
// We only need to test p2 for 'jump crouch purposes' // We only need to test p2 for 'jump crouch purposes'
p2.IsColliding = true; p2.IsColliding = true;
if (count > 3)
{
p2.ThrottleUpdates = true;
}
//System.Console.WriteLine(count.ToString());
//System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2);
} }
} }
@ -667,7 +672,11 @@ namespace OpenSim.Region.Physics.OdePlugin
get { return false; } get { return false; }
set { return; } set { return; }
} }
public override bool ThrottleUpdates
{
get { return false; }
set { return; }
}
public override bool Flying public override bool Flying
{ {
get { return flying; } get { return flying; }
@ -929,6 +938,8 @@ namespace OpenSim.Region.Physics.OdePlugin
public IntPtr _triMeshData; public IntPtr _triMeshData;
private bool iscolliding = false; private bool iscolliding = false;
private bool m_isphysical = false; private bool m_isphysical = false;
private bool m_throttleUpdates = false;
private int throttleCounter = 0;
public bool _zeroFlag = false; public bool _zeroFlag = false;
private bool m_lastUpdateSent = false; private bool m_lastUpdateSent = false;
@ -1098,7 +1109,11 @@ namespace OpenSim.Region.Physics.OdePlugin
get { return iscolliding; } get { return iscolliding; }
set { iscolliding = value; } set { iscolliding = value; }
} }
public override bool ThrottleUpdates
{
get { return m_throttleUpdates; }
set { m_throttleUpdates=value; }
}
public override PhysicsVector Position public override PhysicsVector Position
{ {
@ -1347,6 +1362,8 @@ namespace OpenSim.Region.Physics.OdePlugin
m_rotationalVelocity.Y = 0; m_rotationalVelocity.Y = 0;
m_rotationalVelocity.Z = 0; m_rotationalVelocity.Z = 0;
base.RequestPhysicsterseUpdate(); base.RequestPhysicsterseUpdate();
m_throttleUpdates = false;
throttleCounter = 0;
_zeroFlag = true; _zeroFlag = true;
} }
@ -1382,6 +1399,8 @@ namespace OpenSim.Region.Physics.OdePlugin
m_rotationalVelocity.Z = 0; m_rotationalVelocity.Z = 0;
if (!m_lastUpdateSent) if (!m_lastUpdateSent)
{ {
m_throttleUpdates = false;
throttleCounter = 0;
base.RequestPhysicsterseUpdate(); base.RequestPhysicsterseUpdate();
m_lastUpdateSent = true; m_lastUpdateSent = true;
} }
@ -1406,7 +1425,14 @@ namespace OpenSim.Region.Physics.OdePlugin
_orientation.y = ori.Y; _orientation.y = ori.Y;
_orientation.z = ori.Z; _orientation.z = ori.Z;
m_lastUpdateSent = false; m_lastUpdateSent = false;
base.RequestPhysicsterseUpdate(); if (!m_throttleUpdates || throttleCounter > 15)
{
base.RequestPhysicsterseUpdate();
}
else
{
throttleCounter++;
}
} }
m_lastposition = l_position; m_lastposition = l_position;
} }

View File

@ -204,7 +204,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
get { return false; } get { return false; }
set { return; } set { return; }
} }
public override bool ThrottleUpdates
{
get { return false; }
set { return; }
}
public override bool Flying public override bool Flying
{ {
get { return flying; } get { return flying; }
@ -335,6 +339,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin
get { return false; } get { return false; }
set { return; } set { return; }
} }
public override bool ThrottleUpdates
{
get { return false; }
set { return; }
}
public override PhysicsVector RotationalVelocity public override PhysicsVector RotationalVelocity
{ {
get { return m_rotationalVelocity; } get { return m_rotationalVelocity; }

Binary file not shown.