* Moved BulletX off of the 'constant terse update' method. It now only sends terse updates when needed.

* Removed the 'constant poll method' from SceneObjectPart.cs - It was bad :P
* Updated some Masses in ODE to help large prim slow down by friction easier.
afrisby
Teravus Ovares 2007-11-09 13:45:42 +00:00
parent 7fb227ed1e
commit 90274434c6
3 changed files with 44 additions and 8 deletions

View File

@ -603,11 +603,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
AddTerseUpdateToAllAvatars(); AddTerseUpdateToAllAvatars();
ClearUpdateSchedule(); ClearUpdateSchedule();
if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0)
{ // This causes the Scene to 'poll' physical objects every couple of frames
// bad, so it's been replaced by an event driven method.
//if ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0)
//{
// Only send the constant terse updates on physical objects! // Only send the constant terse updates on physical objects!
ScheduleTerseUpdate(); //ScheduleTerseUpdate();
} //}
} }
else else
{ {

View File

@ -819,6 +819,10 @@ namespace OpenSim.Region.Physics.BulletXPlugin
internal protected virtual void ReSize(PhysicsVector _newSize) internal protected virtual void ReSize(PhysicsVector _newSize)
{ {
} }
public virtual void ScheduleTerseUpdate()
{
base.RequestPhysicsterseUpdate();
}
#endregion #endregion
} }
@ -1003,6 +1007,8 @@ namespace OpenSim.Region.Physics.BulletXPlugin
//For now all prims have the same density, all prims are made of water. Be water my friend! :D //For now all prims have the same density, all prims are made of water. Be water my friend! :D
private const float _density = 1000.0f; private const float _density = 1000.0f;
private BulletXScene _parent_scene; private BulletXScene _parent_scene;
private PhysicsVector m_prev_position = new PhysicsVector(0, 0, 0);
private bool m_lastUpdateSent = false;
public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size, public BulletXPrim(String primName, BulletXScene parent_scene, PhysicsVector pos, PhysicsVector size,
AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs, bool isPhysical) AxiomQuaternion rotation, Mesh mesh, PrimitiveBaseShape pbs, bool isPhysical)
@ -1148,8 +1154,28 @@ namespace OpenSim.Region.Physics.BulletXPlugin
if (_physical) //Updates properties. Prim updates its properties physically if (_physical) //Updates properties. Prim updates its properties physically
{ {
_position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition); _position = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.CenterOfMassPosition);
_velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity); _velocity = BulletXMaths.XnaVector3ToPhysicsVector(rigidBody.LinearVelocity);
_orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation); _orientation = BulletXMaths.XnaQuaternionToAxiomQuaternion(rigidBody.Orientation);
if ((Math.Abs(m_prev_position.X - _position.X) < 0.03)
&& (Math.Abs(m_prev_position.Y - _position.Y) < 0.03)
&& (Math.Abs(m_prev_position.Z - _position.Z) < 0.03))
{
if (!m_lastUpdateSent)
{
_velocity = new PhysicsVector(0, 0, 0);
base.ScheduleTerseUpdate();
m_lastUpdateSent = true;
}
}
else
{
m_lastUpdateSent = false;
base.ScheduleTerseUpdate();
}
m_prev_position = _position;
} }
else //Doesn't updates properties. That's a cancel else //Doesn't updates properties. That's a cancel
{ {

View File

@ -125,6 +125,7 @@ namespace OpenSim.Region.Physics.OdePlugin
contactgroup = d.JointGroupCreate(0); contactgroup = d.JointGroupCreate(0);
//contactgroup //contactgroup
d.WorldSetGravity(world, 0.0f, 0.0f, -10.0f); d.WorldSetGravity(world, 0.0f, 0.0f, -10.0f);
d.WorldSetAutoDisableFlag(world, false); d.WorldSetAutoDisableFlag(world, false);
d.WorldSetContactSurfaceLayer(world, 0.001f); d.WorldSetContactSurfaceLayer(world, 0.001f);
@ -936,7 +937,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private String m_primName; private String m_primName;
private PhysicsVector _target_velocity; private PhysicsVector _target_velocity;
public d.Mass pMass; public d.Mass pMass;
private const float MassMultiplier = 500f; // Ref: Water: 1000kg.. this iset to 500 private const float MassMultiplier = 150f; // Ref: Water: 1000kg.. this iset to 500
private int debugcounter = 0; private int debugcounter = 0;
@ -1361,7 +1362,7 @@ namespace OpenSim.Region.Physics.OdePlugin
//System.Console.WriteLine(Math.Abs(m_lastposition.X - l_position.X).ToString()); //System.Console.WriteLine(Math.Abs(m_lastposition.X - l_position.X).ToString());
_zeroFlag = false; _zeroFlag = false;
} }
m_lastposition = l_position;
if (_zeroFlag) if (_zeroFlag)
@ -1379,6 +1380,11 @@ namespace OpenSim.Region.Physics.OdePlugin
m_rotationalVelocity.X = 0; m_rotationalVelocity.X = 0;
m_rotationalVelocity.Y = 0; m_rotationalVelocity.Y = 0;
m_rotationalVelocity.Z = 0; m_rotationalVelocity.Z = 0;
if (!m_lastUpdateSent)
{
base.RequestPhysicsterseUpdate();
m_lastUpdateSent = true;
}
} }
else else
@ -1399,9 +1405,10 @@ namespace OpenSim.Region.Physics.OdePlugin
_orientation.x = ori.X; _orientation.x = ori.X;
_orientation.y = ori.Y; _orientation.y = ori.Y;
_orientation.z = ori.Z; _orientation.z = ori.Z;
m_lastUpdateSent = false;
base.RequestPhysicsterseUpdate(); base.RequestPhysicsterseUpdate();
} }
m_lastposition = l_position;
} }
else else
{ {