* Reduce the velocity tolerance on sending terse updates to avoid slowly drifting prims/avatars

* Added contacts_per_collision to the ODE config section. This allows you to reduce the maximum number of contact points ODE will generate per collision and reduce the size of the array that stores contact structures
0.6.8-post-fixes
John Hurliman 2009-10-28 12:45:40 -07:00
parent ee0f7e10c8
commit a65c8cdc38
4 changed files with 15 additions and 5 deletions

View File

@ -2394,7 +2394,7 @@ if (m_shape != null) {
/// </summary> /// </summary>
public void SendScheduledUpdates() public void SendScheduledUpdates()
{ {
const float VELOCITY_TOLERANCE = 0.01f; const float VELOCITY_TOLERANCE = 0.0001f;
const float POSITION_TOLERANCE = 0.1f; const float POSITION_TOLERANCE = 0.1f;
const int TIME_MS_TOLERANCE = 3000; const int TIME_MS_TOLERANCE = 3000;

View File

@ -2362,7 +2362,7 @@ namespace OpenSim.Region.Framework.Scenes
public override void Update() public override void Update()
{ {
const float VELOCITY_TOLERANCE = 0.01f; const float VELOCITY_TOLERANCE = 0.0001f;
const float POSITION_TOLERANCE = 10.0f; const float POSITION_TOLERANCE = 10.0f;
const int TIME_MS_TOLERANCE = 3000; const int TIME_MS_TOLERANCE = 3000;

View File

@ -178,8 +178,8 @@ namespace OpenSim.Region.Physics.OdePlugin
//private int m_returncollisions = 10; //private int m_returncollisions = 10;
private readonly IntPtr contactgroup; private readonly IntPtr contactgroup;
internal IntPtr LandGeom;
internal IntPtr LandGeom;
internal IntPtr WaterGeom; internal IntPtr WaterGeom;
private float nmTerrainContactFriction = 255.0f; private float nmTerrainContactFriction = 255.0f;
@ -251,7 +251,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private bool m_NINJA_physics_joints_enabled = false; private bool m_NINJA_physics_joints_enabled = false;
//private Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>(); //private Dictionary<String, IntPtr> jointpart_name_map = new Dictionary<String,IntPtr>();
private readonly Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>(); private readonly Dictionary<String, List<PhysicsJoint>> joints_connecting_actor = new Dictionary<String, List<PhysicsJoint>>();
private d.ContactGeom[] contacts = new d.ContactGeom[80]; private d.ContactGeom[] contacts;
private readonly List<PhysicsJoint> requestedJointsToBeCreated = new List<PhysicsJoint>(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active private readonly List<PhysicsJoint> requestedJointsToBeCreated = new List<PhysicsJoint>(); // lock only briefly. accessed by external code (to request new joints) and by OdeScene.Simulate() to move those joints into pending/active
private readonly List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene. private readonly List<PhysicsJoint> pendingJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
private readonly List<PhysicsJoint> activeJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene. private readonly List<PhysicsJoint> activeJoints = new List<PhysicsJoint>(); // can lock for longer. accessed only by OdeScene.
@ -397,6 +397,8 @@ namespace OpenSim.Region.Physics.OdePlugin
avStandupTensor = 550000f; avStandupTensor = 550000f;
} }
int contactsPerCollision = 80;
if (m_config != null) if (m_config != null)
{ {
IConfig physicsconfig = m_config.Configs["ODEPhysicsSettings"]; IConfig physicsconfig = m_config.Configs["ODEPhysicsSettings"];
@ -439,6 +441,8 @@ namespace OpenSim.Region.Physics.OdePlugin
avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f); avCapRadius = physicsconfig.GetFloat("av_capsule_radius", 0.37f);
avCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", true); avCapsuleTilted = physicsconfig.GetBoolean("av_capsule_tilted", true);
contactsPerCollision = physicsconfig.GetInt("contacts_per_collision", 80);
geomContactPointsStartthrottle = physicsconfig.GetInt("geom_contactpoints_start_throttling", 3); geomContactPointsStartthrottle = physicsconfig.GetInt("geom_contactpoints_start_throttling", 3);
geomUpdatesPerThrottledUpdate = physicsconfig.GetInt("geom_updates_before_throttled_update", 15); geomUpdatesPerThrottledUpdate = physicsconfig.GetInt("geom_updates_before_throttled_update", 15);
geomCrossingFailuresBeforeOutofbounds = physicsconfig.GetInt("geom_crossing_failures_before_outofbounds", 5); geomCrossingFailuresBeforeOutofbounds = physicsconfig.GetInt("geom_crossing_failures_before_outofbounds", 5);
@ -476,10 +480,11 @@ namespace OpenSim.Region.Physics.OdePlugin
m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false);
minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f);
} }
} }
contacts = new d.ContactGeom[contactsPerCollision];
staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)]; staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)];
// Centeral contact friction and bounce // Centeral contact friction and bounce
@ -773,6 +778,8 @@ namespace OpenSim.Region.Physics.OdePlugin
lock (contacts) lock (contacts)
{ {
count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); count = d.Collide(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf);
if (count > contacts.Length)
m_log.Error("[PHYSICS]: Got " + count + " contacts when we asked for a maximum of " + contacts.Length);
} }
} }
catch (SEHException) catch (SEHException)

View File

@ -578,6 +578,9 @@
body_pid_derivative = 35 body_pid_derivative = 35
body_pid_gain = 25 body_pid_gain = 25
; maximum number of contact points to generate per collision
contacts_per_collision = 80
; amount of time a geom/body will try to cross a region border before it gets disabled ; amount of time a geom/body will try to cross a region border before it gets disabled
geom_crossing_failures_before_outofbounds = 5 geom_crossing_failures_before_outofbounds = 5