diff options
author | UbitUmarov | 2012-02-15 17:08:33 +0000 |
---|---|---|
committer | UbitUmarov | 2012-02-15 17:08:33 +0000 |
commit | a758abaa9fa7250d1b61bcd906ca12539307851d (patch) | |
tree | 054b6f66b0c62b66f77e433607ed0aab3245b396 | |
parent | Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff) | |
download | opensim-SC-a758abaa9fa7250d1b61bcd906ca12539307851d.zip opensim-SC-a758abaa9fa7250d1b61bcd906ca12539307851d.tar.gz opensim-SC-a758abaa9fa7250d1b61bcd906ca12539307851d.tar.bz2 opensim-SC-a758abaa9fa7250d1b61bcd906ca12539307851d.tar.xz |
try to make crossings work better. chode no longer prevents crossings i hope
4 files changed, 77 insertions, 27 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 644b78a..77e67ba 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 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 577c0d3..19dedde 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2620,9 +2620,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2620 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); | 2620 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); |
2621 | 2621 | ||
2622 | if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | 2622 | if (ParentGroup.Scene.TestBorderCross(newpos, Cardinals.N) |
2623 | | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | 2623 | || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.S) |
2624 | | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | 2624 | || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.E) |
2625 | | ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) | 2625 | || ParentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) |
2626 | { | 2626 | { |
2627 | ParentGroup.AbsolutePosition = newpos; | 2627 | ParentGroup.AbsolutePosition = newpos; |
2628 | return; | 2628 | return; |
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 | { |