diff options
Diffstat (limited to 'OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs index 42e22ff..95a9741 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs | |||
@@ -732,13 +732,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
732 | 732 | ||
733 | public override void CrossingFailure() | 733 | public override void CrossingFailure() |
734 | { | 734 | { |
735 | m_crossingfailures++; | 735 | int tmp = Interlocked.Increment(ref m_crossingfailures); |
736 | if (m_crossingfailures > _parent_scene.geomCrossingFailuresBeforeOutofbounds) | 736 | if (tmp > _parent_scene.geomCrossingFailuresBeforeOutofbounds) |
737 | { | 737 | { |
738 | base.RaiseOutOfBounds(_position); | 738 | base.RaiseOutOfBounds(_position); |
739 | return; | 739 | return; |
740 | } | 740 | } |
741 | else if (m_crossingfailures == _parent_scene.geomCrossingFailuresBeforeOutofbounds) | 741 | else if (tmp == _parent_scene.geomCrossingFailuresBeforeOutofbounds) |
742 | { | 742 | { |
743 | m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName); | 743 | m_log.Warn("[PHYSICS]: Too many crossing failures for: " + m_primName); |
744 | } | 744 | } |
@@ -3042,10 +3042,9 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!"); | |||
3042 | d.Vector3 torque = d.BodyGetTorque(Body); | 3042 | d.Vector3 torque = d.BodyGetTorque(Body); |
3043 | _torque = new Vector3(torque.X, torque.Y, torque.Z); | 3043 | _torque = new Vector3(torque.X, torque.Y, torque.Z); |
3044 | 3044 | ||
3045 | base.RequestPhysicsterseUpdate(); | ||
3046 | 3045 | ||
3047 | //Console.WriteLine("Move {0} at {1}", m_primName, l_position); | 3046 | //Console.WriteLine("Move {0} at {1}", m_primName, l_position); |
3048 | 3047 | /* | |
3049 | // Check if outside region | 3048 | // Check if outside region |
3050 | // In Scene.cs/CrossPrimGroupIntoNewRegion the object is checked for 0.1M from border! | 3049 | // In Scene.cs/CrossPrimGroupIntoNewRegion the object is checked for 0.1M from border! |
3051 | if (l_position.X > ((float)_parent_scene.WorldExtents.X - fence)) | 3050 | if (l_position.X > ((float)_parent_scene.WorldExtents.X - fence)) |
@@ -3112,7 +3111,52 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!"); | |||
3112 | return; // Dont process any other motion? | 3111 | return; // Dont process any other motion? |
3113 | } // end various methods | 3112 | } // end various methods |
3114 | } // end outside region horizontally | 3113 | } // end outside region horizontally |
3115 | 3114 | */ | |
3115 | if (_position.X < 0f || _position.X > _parent_scene.WorldExtents.X | ||
3116 | || _position.Y < 0f || _position.Y > _parent_scene.WorldExtents.Y | ||
3117 | ) | ||
3118 | { | ||
3119 | // we are outside current region | ||
3120 | // clip position to a stop just outside region and stop it only internally | ||
3121 | // do it only once using m_crossingfailures as control | ||
3122 | _position.X = Util.Clip(l_position.X, -0.2f, _parent_scene.WorldExtents.X + .2f); | ||
3123 | _position.Y = Util.Clip(l_position.Y, -0.2f, _parent_scene.WorldExtents.Y + .2f); | ||
3124 | _position.Z = Util.Clip(l_position.Z, -100f, 50000f); | ||
3125 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); | ||
3126 | d.BodySetLinearVel(Body, 0, 0, 0); | ||
3127 | |||
3128 | if (Interlocked.Exchange(ref m_crossingfailures, 0) == 0) | ||
3129 | { // tell base code only once | ||
3130 | Interlocked.Increment(ref m_crossingfailures); | ||
3131 | base.RequestPhysicsterseUpdate(); | ||
3132 | } | ||
3133 | return; | ||
3134 | } | ||
3135 | |||
3136 | if (Interlocked.Exchange(ref m_crossingfailures, 0) > 1) | ||
3137 | { | ||
3138 | // main simulator had a crossing failure | ||
3139 | // park it inside region | ||
3140 | _position.X = Util.Clip(l_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f); | ||
3141 | _position.Y = Util.Clip(l_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f); | ||
3142 | _position.Z = Util.Clip(l_position.Z, -100f, 50000f); | ||
3143 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); | ||
3144 | |||
3145 | m_lastposition = _position; | ||
3146 | |||
3147 | _velocity = Vector3.Zero; | ||
3148 | m_lastVelocity = _velocity; | ||
3149 | |||
3150 | |||
3151 | if (m_type != Vehicle.TYPE_NONE) | ||
3152 | Halt(); | ||
3153 | |||
3154 | d.BodySetLinearVel(Body, 0, 0, 0); | ||
3155 | base.RequestPhysicsterseUpdate(); | ||
3156 | return; | ||
3157 | } | ||
3158 | |||
3159 | base.RequestPhysicsterseUpdate(); | ||
3116 | 3160 | ||
3117 | if (l_position.Z < 0) | 3161 | if (l_position.Z < 0) |
3118 | { | 3162 | { |