diff options
Diffstat (limited to 'OpenSim')
5 files changed, 122 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9a6dfe1..557555d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1655,35 +1655,38 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1655 | } | 1655 | } |
1656 | 1656 | ||
1657 | // Offset the positions for the new region across the border | 1657 | // Offset the positions for the new region across the border |
1658 | Vector3 oldGroupPosition = grp.RootPart.GroupPosition; | 1658 | // NOT here |
1659 | grp.RootPart.GroupPosition = pos; | ||
1660 | 1659 | ||
1661 | // If we fail to cross the border, then reset the position of the scene object on that border. | 1660 | // If we fail to cross the border, then reset the position of the scene object on that border. |
1662 | uint x = 0, y = 0; | 1661 | uint x = 0, y = 0; |
1663 | Utils.LongToUInts(newRegionHandle, out x, out y); | 1662 | Utils.LongToUInts(newRegionHandle, out x, out y); |
1664 | GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); | 1663 | GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); |
1665 | 1664 | ||
1666 | if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent)) | 1665 | Vector3 oldGroupPosition = grp.RootPart.GroupPosition; |
1666 | |||
1667 | if (destination != null) | ||
1667 | { | 1668 | { |
1668 | m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); | 1669 | grp.RootPart.GroupPosition = pos; // only change this if we think there is anywhere to go |
1670 | if (CrossPrimGroupIntoNewRegion(destination, grp, silent)) | ||
1671 | return; // we did it | ||
1672 | } | ||
1669 | 1673 | ||
1670 | // Need to turn off the physics flags, otherwise the object will continue to attempt to | 1674 | // no one or failed lets go back and tell physics to go on |
1671 | // move out of the region creating an infinite loop of failed attempts to cross | 1675 | oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X, 0.5f, (float)Constants.RegionSize - 0.5f); |
1672 | grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false); | 1676 | oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y, 0.5f, (float)Constants.RegionSize - 0.5f); |
1677 | oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z, 0.5f, 4096.0f); | ||
1673 | 1678 | ||
1674 | // We are going to move the object back to the old position so long as the old position | 1679 | grp.AbsolutePosition = oldGroupPosition; |
1675 | // is in the region | 1680 | grp.Velocity = Vector3.Zero; |
1676 | oldGroupPosition.X = Util.Clamp<float>(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1); | ||
1677 | oldGroupPosition.Y = Util.Clamp<float>(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1); | ||
1678 | oldGroupPosition.Z = Util.Clamp<float>(oldGroupPosition.Z,1.0f,4096.0f); | ||
1679 | 1681 | ||
1680 | grp.AbsolutePosition = oldGroupPosition; | 1682 | if (grp.RootPart.PhysActor != null) |
1683 | grp.RootPart.PhysActor.CrossingFailure(); | ||
1681 | 1684 | ||
1682 | grp.ScheduleGroupForFullUpdate(); | 1685 | grp.ScheduleGroupForFullUpdate(); |
1683 | } | ||
1684 | } | 1686 | } |
1685 | 1687 | ||
1686 | 1688 | ||
1689 | |||
1687 | /// <summary> | 1690 | /// <summary> |
1688 | /// Move the given scene object into a new region | 1691 | /// Move the given scene object into a new region |
1689 | /// </summary> | 1692 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0d14b83..cbd45c3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -461,8 +461,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
461 | 461 | ||
462 | if (Scene != null) | 462 | if (Scene != null) |
463 | { | 463 | { |
464 | if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) | 464 | // if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) |
465 | || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | 465 | // || Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) |
466 | // && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | ||
467 | if ((Scene.TestBorderCross(val, Cardinals.E) || Scene.TestBorderCross(val, Cardinals.W) | ||
468 | || Scene.TestBorderCross(val, Cardinals.N) || Scene.TestBorderCross(val, Cardinals.S)) | ||
466 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) | 469 | && !IsAttachmentCheckFull() && (!Scene.LoadingPrims)) |
467 | { | 470 | { |
468 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); | 471 | IEntityTransferModule entityTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); |
@@ -489,7 +492,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
489 | canCross = false; | 492 | canCross = false; |
490 | break; | 493 | break; |
491 | } | 494 | } |
492 | 495 | ||
493 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); | 496 | m_log.DebugFormat("[SCENE OBJECT]: Avatar {0} needs to be crossed to {1}", av.Name, destination.RegionName); |
494 | } | 497 | } |
495 | 498 | ||
@@ -534,8 +537,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
534 | return; | 537 | return; |
535 | } | 538 | } |
536 | } | 539 | } |
540 | else if (RootPart.PhysActor != null) | ||
541 | { | ||
542 | RootPart.PhysActor.CrossingFailure(); | ||
543 | } | ||
537 | 544 | ||
538 | val = AbsolutePosition; | 545 | Vector3 oldp = AbsolutePosition; |
546 | val.X = Util.Clamp<float>(oldp.X, 0.5f, (float)Constants.RegionSize - 0.5f); | ||
547 | val.Y = Util.Clamp<float>(oldp.Y, 0.5f, (float)Constants.RegionSize - 0.5f); | ||
548 | val.Z = Util.Clamp<float>(oldp.Z, 0.5f, 4096.0f); | ||
539 | } | 549 | } |
540 | } | 550 | } |
541 | 551 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4a08ce3..d6d04b2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2615,9 +2615,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2615 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); | 2615 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); |
2616 | 2616 | ||
2617 | if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | 2617 | if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) |
2618 | | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | 2618 | || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) |
2619 | | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | 2619 | || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) |
2620 | | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) | 2620 | || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) |
2621 | { | 2621 | { |
2622 | ParentGroup.AbsolutePosition = newpos; | 2622 | ParentGroup.AbsolutePosition = newpos; |
2623 | return; | 2623 | return; |
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs index 42e22ff..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,16 +732,38 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
732 | 732 | ||
733 | public override void CrossingFailure() | 733 | public override void CrossingFailure() |
734 | { | 734 | { |
735 | m_crossingfailures++; | 735 | if (m_outofBounds) |
736 | if (m_crossingfailures > _parent_scene.geomCrossingFailuresBeforeOutofbounds) | 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 | /* | ||
756 | int tmp = Interlocked.Increment(ref m_crossingfailures); | ||
757 | if (tmp > _parent_scene.geomCrossingFailuresBeforeOutofbounds) | ||
737 | { | 758 | { |
738 | base.RaiseOutOfBounds(_position); | 759 | base.RaiseOutOfBounds(_position); |
739 | return; | 760 | return; |
740 | } | 761 | } |
741 | else if (m_crossingfailures == _parent_scene.geomCrossingFailuresBeforeOutofbounds) | 762 | else if (tmp == _parent_scene.geomCrossingFailuresBeforeOutofbounds) |
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 |
@@ -3042,10 +3064,9 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!"); | |||
3042 | d.Vector3 torque = d.BodyGetTorque(Body); | 3064 | d.Vector3 torque = d.BodyGetTorque(Body); |
3043 | _torque = new Vector3(torque.X, torque.Y, torque.Z); | 3065 | _torque = new Vector3(torque.X, torque.Y, torque.Z); |
3044 | 3066 | ||
3045 | base.RequestPhysicsterseUpdate(); | ||
3046 | 3067 | ||
3047 | //Console.WriteLine("Move {0} at {1}", m_primName, l_position); | 3068 | //Console.WriteLine("Move {0} at {1}", m_primName, l_position); |
3048 | 3069 | /* | |
3049 | // Check if outside region | 3070 | // Check if outside region |
3050 | // In Scene.cs/CrossPrimGroupIntoNewRegion the object is checked for 0.1M from border! | 3071 | // In Scene.cs/CrossPrimGroupIntoNewRegion the object is checked for 0.1M from border! |
3051 | if (l_position.X > ((float)_parent_scene.WorldExtents.X - fence)) | 3072 | if (l_position.X > ((float)_parent_scene.WorldExtents.X - fence)) |
@@ -3112,7 +3133,55 @@ Console.WriteLine("ODEPrim JointCreateFixed !!!"); | |||
3112 | return; // Dont process any other motion? | 3133 | return; // Dont process any other motion? |
3113 | } // end various methods | 3134 | } // end various methods |
3114 | } // end outside region horizontally | 3135 | } // end outside region horizontally |
3115 | 3136 | */ | |
3137 | if (_position.X < 0f || _position.X > _parent_scene.WorldExtents.X | ||
3138 | || _position.Y < 0f || _position.Y > _parent_scene.WorldExtents.Y | ||
3139 | ) | ||
3140 | { | ||
3141 | // we are outside current region | ||
3142 | // clip position to a stop just outside region and stop it only internally | ||
3143 | // do it only once using m_crossingfailures as control | ||
3144 | _position.X = Util.Clip(l_position.X, -0.2f, _parent_scene.WorldExtents.X + .2f); | ||
3145 | _position.Y = Util.Clip(l_position.Y, -0.2f, _parent_scene.WorldExtents.Y + .2f); | ||
3146 | _position.Z = Util.Clip(l_position.Z, -100f, 50000f); | ||
3147 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); | ||
3148 | d.BodySetLinearVel(Body, 0, 0, 0); | ||
3149 | /* | ||
3150 | if (Interlocked.Exchange(ref m_crossingfailures, m_crossingfailures) == 0) | ||
3151 | { // tell base code only once | ||
3152 | Interlocked.Increment(ref m_crossingfailures); | ||
3153 | base.RequestPhysicsterseUpdate(); | ||
3154 | } | ||
3155 | */ | ||
3156 | m_outofBounds = true; | ||
3157 | base.RequestPhysicsterseUpdate(); | ||
3158 | return; | ||
3159 | } | ||
3160 | /* | ||
3161 | if (Interlocked.Exchange(ref m_crossingfailures, 0) != 0) | ||
3162 | { | ||
3163 | // main simulator had a crossing failure | ||
3164 | // park it inside region | ||
3165 | _position.X = Util.Clip(l_position.X, 0.5f, _parent_scene.WorldExtents.X - 0.5f); | ||
3166 | _position.Y = Util.Clip(l_position.Y, 0.5f, _parent_scene.WorldExtents.Y - 0.5f); | ||
3167 | _position.Z = Util.Clip(l_position.Z, -100f, 50000f); | ||
3168 | d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); | ||
3169 | |||
3170 | m_lastposition = _position; | ||
3171 | |||
3172 | _velocity = Vector3.Zero; | ||
3173 | m_lastVelocity = _velocity; | ||
3174 | |||
3175 | |||
3176 | if (m_type != Vehicle.TYPE_NONE) | ||
3177 | Halt(); | ||
3178 | |||
3179 | d.BodySetLinearVel(Body, 0, 0, 0); | ||
3180 | base.RequestPhysicsterseUpdate(); | ||
3181 | return; | ||
3182 | } | ||
3183 | */ | ||
3184 | base.RequestPhysicsterseUpdate(); | ||
3116 | 3185 | ||
3117 | if (l_position.Z < 0) | 3186 | if (l_position.Z < 0) |
3118 | { | 3187 | { |
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs index 353db44..cf7c1d7 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs | |||
@@ -1536,7 +1536,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1536 | List<OdePrim> removeprims = null; | 1536 | List<OdePrim> removeprims = null; |
1537 | foreach (OdePrim chr in _activeprims) | 1537 | foreach (OdePrim chr in _activeprims) |
1538 | { | 1538 | { |
1539 | if (chr.Body != IntPtr.Zero && d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) | 1539 | if (chr.Body != IntPtr.Zero && d.BodyIsEnabled(chr.Body) && (!chr.m_disabled) && !chr.m_outofBounds) |
1540 | { | 1540 | { |
1541 | try | 1541 | try |
1542 | { | 1542 | { |
@@ -3410,13 +3410,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3410 | public void SetTerrain(float[] heightMap, Vector3 pOffset) | 3410 | public void SetTerrain(float[] heightMap, Vector3 pOffset) |
3411 | { | 3411 | { |
3412 | 3412 | ||
3413 | uint regionsize = (uint) Constants.RegionSize; // visible region size eg. 256(M) | 3413 | int regionsize = (int) Constants.RegionSize; // visible region size eg. 256(M) |
3414 | 3414 | ||
3415 | uint heightmapWidth = regionsize + 1; // ODE map size 257 x 257 (Meters) (1 extra | 3415 | int heightmapWidth = regionsize + 2; // ODE map size 257 x 257 (Meters) (1 extra |
3416 | uint heightmapHeight = regionsize + 1; | 3416 | int heightmapHeight = regionsize + 2; |
3417 | 3417 | ||
3418 | uint heightmapWidthSamples = (uint)regionsize + 2; // Sample file size, 258 x 258 samples | 3418 | int heightmapWidthSamples = (int)regionsize + 2; // Sample file size, 258 x 258 samples |
3419 | uint heightmapHeightSamples = (uint)regionsize + 2; | 3419 | int heightmapHeightSamples = (int)regionsize + 2; |
3420 | 3420 | ||
3421 | // Array of height samples for ODE | 3421 | // Array of height samples for ODE |
3422 | float[] _heightmap; | 3422 | float[] _heightmap; |
@@ -3432,10 +3432,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3432 | float hfmax = -2000f; | 3432 | float hfmax = -2000f; |
3433 | float minele = 0.0f; // Dont allow -ve heights | 3433 | float minele = 0.0f; // Dont allow -ve heights |
3434 | 3434 | ||
3435 | uint x = 0; | 3435 | int x = 0; |
3436 | uint y = 0; | 3436 | int y = 0; |
3437 | uint xx = 0; | 3437 | int xx = 0; |
3438 | uint yy = 0; | 3438 | int yy = 0; |
3439 | 3439 | ||
3440 | // load the height samples array from the heightMap | 3440 | // load the height samples array from the heightMap |
3441 | for ( x = 0; x < heightmapWidthSamples; x++) // 0 to 257 | 3441 | for ( x = 0; x < heightmapWidthSamples; x++) // 0 to 257 |