aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-02-15 20:33:31 +0000
committerUbitUmarov2012-02-15 20:33:31 +0000
commitf6c35cf26f759407268a46689d94e246a82b4286 (patch)
treee07bf46c4366705428d55d2ad79c3937390e66be /OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
parentdon't freeze with a sitted avatar in a border without other sim. Still messy :( (diff)
downloadopensim-SC_OLD-f6c35cf26f759407268a46689d94e246a82b4286.zip
opensim-SC_OLD-f6c35cf26f759407268a46689d94e246a82b4286.tar.gz
opensim-SC_OLD-f6c35cf26f759407268a46689d94e246a82b4286.tar.bz2
opensim-SC_OLD-f6c35cf26f759407268a46689d94e246a82b4286.tar.xz
Now if chode prim.cs detects out of bounds it requests a update and blocks movement and colisions. Base code must do a PhysActor.CrossingFailure() to make it move again inside sim or delete it.
Diffstat (limited to 'OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs')
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs45
1 files changed, 35 insertions, 10 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
index 073241f..a68dcb7 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.Physics.OdePlugin
166 public int m_roundsUnderMotionThreshold; 166 public int m_roundsUnderMotionThreshold;
167 private int m_crossingfailures; 167 private int m_crossingfailures;
168 168
169 public bool outofBounds; 169 public bool m_outofBounds;
170 private float m_density = 10.000006836f; // Aluminum g/cm3; 170 private float m_density = 10.000006836f; // Aluminum g/cm3;
171 171
172 public bool _zeroFlag; // if body has been stopped 172 public bool _zeroFlag; // if body has been stopped
@@ -732,6 +732,27 @@ namespace OpenSim.Region.Physics.OdePlugin
732 732
733 public override void CrossingFailure() 733 public override void CrossingFailure()
734 { 734 {
735 if (m_outofBounds)
736 {
737 _position.X = Util.Clip(_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f);
738 _position.Y = Util.Clip(_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f);
739 _position.Z = Util.Clip(_position.Z, -100f, 50000f);
740 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
741
742 m_lastposition = _position;
743
744 _velocity = Vector3.Zero;
745 m_lastVelocity = _velocity;
746
747
748 if (m_type != Vehicle.TYPE_NONE)
749 Halt();
750
751 d.BodySetLinearVel(Body, 0, 0, 0);
752 base.RequestPhysicsterseUpdate();
753 m_outofBounds = false;
754 }
755/*
735 int tmp = Interlocked.Increment(ref m_crossingfailures); 756 int tmp = Interlocked.Increment(ref m_crossingfailures);
736 if (tmp > _parent_scene.geomCrossingFailuresBeforeOutofbounds) 757 if (tmp > _parent_scene.geomCrossingFailuresBeforeOutofbounds)
737 { 758 {
@@ -742,6 +763,7 @@ namespace OpenSim.Region.Physics.OdePlugin
742 { 763 {
743 m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName); 764 m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName);
744 } 765 }
766 */
745 } 767 }
746 768
747 public override float Buoyancy 769 public override float Buoyancy
@@ -3011,7 +3033,7 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!");
3011 3033
3012 if(revcount > 0) revcount--; 3034 if(revcount > 0) revcount--;
3013 3035
3014 if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // Only move root prims. 3036 if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim && !m_outofBounds) // Only move root prims.
3015 { 3037 {
3016 // Old public void UpdatePositionAndVelocity(), more accuratley calculated here 3038 // Old public void UpdatePositionAndVelocity(), more accuratley calculated here
3017 bool lastZeroFlag = _zeroFlag; // was it stopped 3039 bool lastZeroFlag = _zeroFlag; // was it stopped
@@ -3124,15 +3146,18 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!");
3124 _position.Z = Util.Clip(l_position.Z, -100f, 50000f); 3146 _position.Z = Util.Clip(l_position.Z, -100f, 50000f);
3125 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); 3147 d.BodySetPosition(Body, _position.X, _position.Y, _position.Z);
3126 d.BodySetLinearVel(Body, 0, 0, 0); 3148 d.BodySetLinearVel(Body, 0, 0, 0);
3127 3149 /*
3128 if (Interlocked.Exchange(ref m_crossingfailures, m_crossingfailures) == 0) 3150 if (Interlocked.Exchange(ref m_crossingfailures, m_crossingfailures) == 0)
3129 { // tell base code only once 3151 { // tell base code only once
3130 Interlocked.Increment(ref m_crossingfailures); 3152 Interlocked.Increment(ref m_crossingfailures);
3131 base.RequestPhysicsterseUpdate(); 3153 base.RequestPhysicsterseUpdate();
3132 } 3154 }
3155 */
3156 m_outofBounds = true;
3157 base.RequestPhysicsterseUpdate();
3133 return; 3158 return;
3134 } 3159 }
3135 3160/*
3136 if (Interlocked.Exchange(ref m_crossingfailures, 0) != 0) 3161 if (Interlocked.Exchange(ref m_crossingfailures, 0) != 0)
3137 { 3162 {
3138 // main simulator had a crossing failure 3163 // main simulator had a crossing failure
@@ -3155,7 +3180,7 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!");
3155 base.RequestPhysicsterseUpdate(); 3180 base.RequestPhysicsterseUpdate();
3156 return; 3181 return;
3157 } 3182 }
3158 3183*/
3159 base.RequestPhysicsterseUpdate(); 3184 base.RequestPhysicsterseUpdate();
3160 3185
3161 if (l_position.Z < 0) 3186 if (l_position.Z < 0)