aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs42
1 files changed, 38 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 2bf96e4..b0e9a91 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -2185,9 +2185,30 @@ Console.WriteLine(" JointCreateFixed");
2185 if (IsPhysical) 2185 if (IsPhysical)
2186 { 2186 {
2187 Vector3 iforce = Vector3.Zero; 2187 Vector3 iforce = Vector3.Zero;
2188 for (int i = 0; i < m_forcelist.Count; i++) 2188 int i = 0;
2189 try
2189 { 2190 {
2190 iforce = iforce + (m_forcelist[i] * 100); 2191 for (i = 0; i < m_forcelist.Count; i++)
2192 {
2193
2194 iforce = iforce + (m_forcelist[i] * 100);
2195 }
2196 }
2197 catch (IndexOutOfRangeException)
2198 {
2199 m_forcelist = new List<Vector3>();
2200 m_collisionscore = 0;
2201 m_interpenetrationcount = 0;
2202 m_taintforce = false;
2203 return;
2204 }
2205 catch (ArgumentOutOfRangeException)
2206 {
2207 m_forcelist = new List<Vector3>();
2208 m_collisionscore = 0;
2209 m_interpenetrationcount = 0;
2210 m_taintforce = false;
2211 return;
2191 } 2212 }
2192 d.BodyEnable(Body); 2213 d.BodyEnable(Body);
2193 d.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z); 2214 d.BodyAddForce(Body, iforce.X, iforce.Y, iforce.Z);
@@ -2416,6 +2437,9 @@ Console.WriteLine(" JointCreateFixed");
2416 { 2437 {
2417 // Averate previous velocity with the new one so 2438 // Averate previous velocity with the new one so
2418 // client object interpolation works a 'little' better 2439 // client object interpolation works a 'little' better
2440 if (_zeroFlag)
2441 return Vector3.Zero;
2442
2419 Vector3 returnVelocity = Vector3.Zero; 2443 Vector3 returnVelocity = Vector3.Zero;
2420 returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; 2444 returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2;
2421 returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2; 2445 returnVelocity.Y = (m_lastVelocity.Y + _velocity.Y)/2;
@@ -2518,7 +2542,9 @@ Console.WriteLine(" JointCreateFixed");
2518 { 2542 {
2519 if (force.IsFinite()) 2543 if (force.IsFinite())
2520 { 2544 {
2521 m_forcelist.Add(force); 2545 lock (m_forcelist)
2546 m_forcelist.Add(force);
2547
2522 m_taintforce = true; 2548 m_taintforce = true;
2523 } 2549 }
2524 else 2550 else
@@ -2702,7 +2728,7 @@ Console.WriteLine(" JointCreateFixed");
2702 //outofBounds = true; 2728 //outofBounds = true;
2703 } 2729 }
2704 2730
2705// float Adiff = 1.0f - Math.Abs(Quaternion.Dot(m_lastorientation, l_orientation)); 2731 //float Adiff = 1.0f - Math.Abs(Quaternion.Dot(m_lastorientation, l_orientation));
2706//Console.WriteLine("Adiff " + m_primName + " = " + Adiff); 2732//Console.WriteLine("Adiff " + m_primName + " = " + Adiff);
2707 if ((Math.Abs(m_lastposition.X - l_position.X) < 0.02) 2733 if ((Math.Abs(m_lastposition.X - l_position.X) < 0.02)
2708 && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02) 2734 && (Math.Abs(m_lastposition.Y - l_position.Y) < 0.02)
@@ -2718,6 +2744,8 @@ Console.WriteLine(" JointCreateFixed");
2718 { 2744 {
2719 //m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString()); 2745 //m_log.Debug(Math.Abs(m_lastposition.X - l_position.X).ToString());
2720 _zeroFlag = false; 2746 _zeroFlag = false;
2747 m_lastUpdateSent = false;
2748 //m_throttleUpdates = false;
2721 } 2749 }
2722 2750
2723 if (_zeroFlag) 2751 if (_zeroFlag)
@@ -2744,7 +2772,9 @@ Console.WriteLine(" JointCreateFixed");
2744 m_rotationalVelocity = pv; 2772 m_rotationalVelocity = pv;
2745 2773
2746 if (_parent == null) 2774 if (_parent == null)
2775 {
2747 base.RequestPhysicsterseUpdate(); 2776 base.RequestPhysicsterseUpdate();
2777 }
2748 2778
2749 m_lastUpdateSent = true; 2779 m_lastUpdateSent = true;
2750 } 2780 }
@@ -2754,7 +2784,9 @@ Console.WriteLine(" JointCreateFixed");
2754 if (lastZeroFlag != _zeroFlag) 2784 if (lastZeroFlag != _zeroFlag)
2755 { 2785 {
2756 if (_parent == null) 2786 if (_parent == null)
2787 {
2757 base.RequestPhysicsterseUpdate(); 2788 base.RequestPhysicsterseUpdate();
2789 }
2758 } 2790 }
2759 2791
2760 m_lastVelocity = _velocity; 2792 m_lastVelocity = _velocity;
@@ -2787,7 +2819,9 @@ Console.WriteLine(" JointCreateFixed");
2787 if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate) 2819 if (!m_throttleUpdates || throttleCounter > _parent_scene.geomUpdatesPerThrottledUpdate)
2788 { 2820 {
2789 if (_parent == null) 2821 if (_parent == null)
2822 {
2790 base.RequestPhysicsterseUpdate(); 2823 base.RequestPhysicsterseUpdate();
2824 }
2791 } 2825 }
2792 else 2826 else
2793 { 2827 {