From 9ba10af6b20712a09a9b0c92a650c96dbbede2f2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sun, 22 Nov 2009 21:08:54 -0500 Subject: * Added missing lock to m_forcelist when AddForce is called. When a user dragged a prim, in some cases, it would corrupt the datatype in memory and throw spurious IndexOutOfRangeExceptions. * Physics a situation that causes physics to spew redline messages to the console forever. --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 6f14f7b..17552d2 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -2126,9 +2126,30 @@ Console.WriteLine(" JointCreateFixed"); if (IsPhysical) { Vector3 iforce = Vector3.Zero; - for (int i = 0; i < m_forcelist.Count; i++) + int i = 0; + try + { + for (i = 0; i < m_forcelist.Count; i++) + { + + iforce = iforce + (m_forcelist[i] * 100); + } + } + catch (IndexOutOfRangeException) + { + m_forcelist = new List(); + m_collisionscore = 0; + m_interpenetrationcount = 0; + m_taintforce = false; + return; + } + catch (ArgumentOutOfRangeException) { - iforce = iforce + (m_forcelist[i] * 100); + m_forcelist = new List(); + m_collisionscore = 0; + m_interpenetrationcount = 0; + m_taintforce = false; + return; } d.BodyEnable(Body); d.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z); @@ -2462,7 +2483,9 @@ Console.WriteLine(" JointCreateFixed"); { if (force.IsFinite()) { - m_forcelist.Add(force); + lock (m_forcelist) + m_forcelist.Add(force); + m_taintforce = true; } else -- cgit v1.1 From 21f80b6507077b7f554ff43b71408c484c515298 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sun, 22 Nov 2009 22:04:52 -0500 Subject: * Adds a test for if the collision is at the bottom of the capsule on avatar. This prevents the 'double jump' capability that's been occurring for ages when avatar collide with prim on the side. --- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 981cf43..e6b31ca 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -835,7 +835,18 @@ namespace OpenSim.Region.Physics.OdePlugin // allows us to have different settings // We only need to test p2 for 'jump crouch purposes' - p2.IsColliding = true; + if (p2 is OdeCharacter) + { + // Testing if the collision is at the feet of the avatar + + //m_log.DebugFormat("[PHYSICS]: {0} - {1} - {2} - {3}", curContact.pos.Z, p2.Position.Z, (p2.Position.Z - curContact.pos.Z), (p2.Size.Z * 0.6f)); + if ((p2.Position.Z - curContact.pos.Z) > (p2.Size.Z * 0.6f)) + p2.IsColliding = true; + } + else + { + p2.IsColliding = true; + } //if ((framecount % m_returncollisions) == 0) -- cgit v1.1