diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 146 |
1 files changed, 70 insertions, 76 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4cc4d94..56c3b52 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1123,6 +1123,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1123 | if (part == null) | 1123 | if (part == null) |
1124 | { | 1124 | { |
1125 | m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID); | 1125 | m_log.ErrorFormat("[SCENE PRESENCE]: Can't find prim {0} to sit on", ParentUUID); |
1126 | ParentID = 0; | ||
1127 | ParentPart = null; | ||
1128 | PrevSitOffset = Vector3.Zero; | ||
1129 | ClearControls(); | ||
1130 | IsLoggingIn = false; | ||
1126 | } | 1131 | } |
1127 | else | 1132 | else |
1128 | { | 1133 | { |
@@ -1216,13 +1221,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1216 | else | 1221 | else |
1217 | AddToPhysicalScene(isFlying); | 1222 | AddToPhysicalScene(isFlying); |
1218 | 1223 | ||
1219 | // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a | ||
1220 | // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it | ||
1221 | // since it requires a physics actor to be present. If it is left any later, then physics appears to reset | ||
1222 | // the value to a negative position which does not trigger the border cross. | ||
1223 | // This may not be the best location for this. | ||
1224 | CheckForBorderCrossing(); | ||
1225 | |||
1226 | if (ForceFly) | 1224 | if (ForceFly) |
1227 | { | 1225 | { |
1228 | Flying = true; | 1226 | Flying = true; |
@@ -1231,12 +1229,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
1231 | { | 1229 | { |
1232 | Flying = false; | 1230 | Flying = false; |
1233 | } | 1231 | } |
1234 | } | ||
1235 | // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying | ||
1236 | // avatar to return to the standing position in mid-air. On login it looks like this is being sent | ||
1237 | // elsewhere anyway | ||
1238 | // Animator.SendAnimPack(); | ||
1239 | 1232 | ||
1233 | // XXX: This is to trigger any secondary teleport needed for a megaregion when the user has teleported to a | ||
1234 | // location outside the 'root region' (the south-west 256x256 corner). This is the earlist we can do it | ||
1235 | // since it requires a physics actor to be present. If it is left any later, then physics appears to reset | ||
1236 | // the value to a negative position which does not trigger the border cross. | ||
1237 | // This may not be the best location for this. | ||
1238 | |||
1239 | |||
1240 | // its not | ||
1241 | // CheckForBorderCrossing(); | ||
1242 | } | ||
1243 | |||
1240 | m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 1244 | m_log.DebugFormat("[MakeRootAgent] position and physical: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
1241 | m_scene.SwapRootAgentCount(false); | 1245 | m_scene.SwapRootAgentCount(false); |
1242 | 1246 | ||
@@ -2734,7 +2738,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2734 | ParentID = 0; | 2738 | ParentID = 0; |
2735 | ParentPart = null; | 2739 | ParentPart = null; |
2736 | 2740 | ||
2737 | |||
2738 | if (part.SitTargetAvatar == UUID) | 2741 | if (part.SitTargetAvatar == UUID) |
2739 | standRotation = standRotation * part.SitTargetOrientation; | 2742 | standRotation = standRotation * part.SitTargetOrientation; |
2740 | else | 2743 | else |
@@ -2761,12 +2764,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2761 | 2764 | ||
2762 | Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; | 2765 | Vector3 standPos = sitPartWorldPosition + adjustmentForSitPose; |
2763 | 2766 | ||
2764 | // m_log.DebugFormat( | ||
2765 | // "[SCENE PRESENCE]: Setting stand to pos {0}, (adjustmentForSitPosition {1}, adjustmentForSitPose {2}) rotation {3} for {4} in {5}", | ||
2766 | // standPos, adjustmentForSitPosition, adjustmentForSitPose, standRotation, Name, Scene.Name); | ||
2767 | |||
2768 | standPos.X = Util.Clamp<float>(standPos.X, 0.5f, (float)Constants.RegionSize - 0.5f); | ||
2769 | standPos.Y = Util.Clamp<float>(standPos.Y, 0.5f, (float)Constants.RegionSize - 0.5f); | ||
2770 | m_pos = standPos; | 2767 | m_pos = standPos; |
2771 | } | 2768 | } |
2772 | 2769 | ||
@@ -3308,6 +3305,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3308 | 3305 | ||
3309 | if (IsChildAgent == false) | 3306 | if (IsChildAgent == false) |
3310 | { | 3307 | { |
3308 | CheckForBorderCrossing(); | ||
3309 | |||
3311 | if (IsInTransit) | 3310 | if (IsInTransit) |
3312 | return; | 3311 | return; |
3313 | 3312 | ||
@@ -3329,8 +3328,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3329 | m_lastVelocity = Velocity; | 3328 | m_lastVelocity = Velocity; |
3330 | } | 3329 | } |
3331 | 3330 | ||
3332 | CheckForBorderCrossing(); | ||
3333 | |||
3334 | CheckForSignificantMovement(); // sends update to the modules. | 3331 | CheckForSignificantMovement(); // sends update to the modules. |
3335 | } | 3332 | } |
3336 | } | 3333 | } |
@@ -3847,7 +3844,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3847 | protected void CheckForBorderCrossing() | 3844 | protected void CheckForBorderCrossing() |
3848 | { | 3845 | { |
3849 | // Check that we we are not a child | 3846 | // Check that we we are not a child |
3850 | if (IsChildAgent) | 3847 | if (IsChildAgent || IsInTransit) |
3851 | return; | 3848 | return; |
3852 | 3849 | ||
3853 | // If we don't have a PhysActor, we can't cross anyway | 3850 | // If we don't have a PhysActor, we can't cross anyway |
@@ -3857,25 +3854,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
3857 | if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero) | 3854 | if (ParentID != 0 || PhysicsActor == null || ParentUUID != UUID.Zero) |
3858 | return; | 3855 | return; |
3859 | 3856 | ||
3860 | if (IsInTransit) | ||
3861 | return; | ||
3862 | |||
3863 | Vector3 pos2 = AbsolutePosition; | 3857 | Vector3 pos2 = AbsolutePosition; |
3864 | Vector3 vel = Velocity; | 3858 | Vector3 vel = Velocity; |
3865 | int neighbor = 0; | ||
3866 | int[] fix = new int[2]; | ||
3867 | 3859 | ||
3868 | float timeStep = 0.1f; | 3860 | float timeStep = 0.1f; |
3869 | pos2.X = pos2.X + (vel.X * timeStep); | 3861 | pos2.X += vel.X * timeStep; |
3870 | pos2.Y = pos2.Y + (vel.Y * timeStep); | 3862 | pos2.Y += vel.Y * timeStep; |
3871 | pos2.Z = pos2.Z + (vel.Z * timeStep); | 3863 | pos2.Z += vel.Z * timeStep; |
3872 | |||
3873 | 3864 | ||
3874 | // m_log.DebugFormat( | 3865 | // m_log.DebugFormat( |
3875 | // "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}", | 3866 | // "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}", |
3876 | // pos2, Name, Scene.Name); | 3867 | // pos2, Name, Scene.Name); |
3877 | 3868 | /* | |
3878 | // Checks if where it's headed exists a region | 3869 | // Checks if where it's headed exists a region |
3870 | int neighbor = 0; | ||
3871 | int[] fix = new int[2]; | ||
3872 | |||
3879 | bool needsTransit = false; | 3873 | bool needsTransit = false; |
3880 | if (m_scene.TestBorderCross(pos2, Cardinals.W)) | 3874 | if (m_scene.TestBorderCross(pos2, Cardinals.W)) |
3881 | { | 3875 | { |
@@ -3925,59 +3919,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
3925 | } | 3919 | } |
3926 | 3920 | ||
3927 | // Makes sure avatar does not end up outside region | 3921 | // Makes sure avatar does not end up outside region |
3922 | |||
3928 | if (neighbor <= 0) | 3923 | if (neighbor <= 0) |
3929 | { | 3924 | { |
3930 | if (needsTransit) | 3925 | if (needsTransit) |
3931 | { | 3926 | { |
3932 | if (m_requestedSitTargetUUID == UUID.Zero) | 3927 | CrossToNewRegionFail(); |
3933 | { | ||
3934 | bool isFlying = Flying; | ||
3935 | RemoveFromPhysicalScene(); | ||
3936 | |||
3937 | Vector3 pos = AbsolutePosition; | ||
3938 | if (AbsolutePosition.X < 0) | ||
3939 | pos.X += Velocity.X * 2; | ||
3940 | else if (AbsolutePosition.X > Constants.RegionSize) | ||
3941 | pos.X -= Velocity.X * 2; | ||
3942 | if (AbsolutePosition.Y < 0) | ||
3943 | pos.Y += Velocity.Y * 2; | ||
3944 | else if (AbsolutePosition.Y > Constants.RegionSize) | ||
3945 | pos.Y -= Velocity.Y * 2; | ||
3946 | Velocity = Vector3.Zero; | ||
3947 | AbsolutePosition = pos; | ||
3948 | |||
3949 | // m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition); | ||
3950 | |||
3951 | AddToPhysicalScene(isFlying); | ||
3952 | } | ||
3953 | } | 3928 | } |
3954 | } | 3929 | } |
3955 | else if (neighbor > 0) | 3930 | else if (neighbor > 0) |
3956 | { | 3931 | { |
3957 | if (!CrossToNewRegion()) | 3932 | if (!CrossToNewRegion()) |
3958 | { | 3933 | { |
3959 | if (m_requestedSitTargetUUID == UUID.Zero) | 3934 | CrossToNewRegionFail(); |
3960 | { | ||
3961 | bool isFlying = Flying; | ||
3962 | RemoveFromPhysicalScene(); | ||
3963 | |||
3964 | Vector3 pos = AbsolutePosition; | ||
3965 | if (AbsolutePosition.X < 0) | ||
3966 | pos.X += Velocity.X * 2; | ||
3967 | else if (AbsolutePosition.X > Constants.RegionSize) | ||
3968 | pos.X -= Velocity.X * 2; | ||
3969 | if (AbsolutePosition.Y < 0) | ||
3970 | pos.Y += Velocity.Y * 2; | ||
3971 | else if (AbsolutePosition.Y > Constants.RegionSize) | ||
3972 | pos.Y -= Velocity.Y * 2; | ||
3973 | Velocity = Vector3.Zero; | ||
3974 | AbsolutePosition = pos; | ||
3975 | |||
3976 | AddToPhysicalScene(isFlying); | ||
3977 | } | ||
3978 | } | 3935 | } |
3979 | } | 3936 | } |
3937 | */ | ||
3938 | bool needsTransit = false; | ||
3939 | |||
3940 | if (pos2.X < 0) | ||
3941 | needsTransit = true; | ||
3942 | else if (pos2.X > m_scene.RegionInfo.RegionSizeX) | ||
3943 | needsTransit = true; | ||
3944 | else if (pos2.Y < 0) | ||
3945 | needsTransit = true; | ||
3946 | else if (pos2.Y > m_scene.RegionInfo.RegionSizeY) | ||
3947 | needsTransit = true; | ||
3948 | |||
3949 | if (needsTransit) | ||
3950 | { | ||
3951 | if (!CrossToNewRegion() && m_requestedSitTargetUUID == UUID.Zero) | ||
3952 | { | ||
3953 | // we don't have entity transfer module | ||
3954 | Vector3 pos = AbsolutePosition; | ||
3955 | float px = pos.X; | ||
3956 | if (px < 0) | ||
3957 | pos.X += Velocity.X * 2; | ||
3958 | else if (px > m_scene.RegionInfo.RegionSizeX) | ||
3959 | pos.X -= Velocity.X * 2; | ||
3980 | 3960 | ||
3961 | float py = pos.Y; | ||
3962 | if (py < 0) | ||
3963 | pos.Y += Velocity.Y * 2; | ||
3964 | else if (py > m_scene.RegionInfo.RegionSizeY) | ||
3965 | pos.Y -= Velocity.Y * 2; | ||
3966 | |||
3967 | Velocity = Vector3.Zero; | ||
3968 | AbsolutePosition = pos; | ||
3969 | } | ||
3970 | } | ||
3981 | } | 3971 | } |
3982 | 3972 | ||
3983 | public void CrossToNewRegionFail() | 3973 | public void CrossToNewRegionFail() |
@@ -3988,14 +3978,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3988 | RemoveFromPhysicalScene(); | 3978 | RemoveFromPhysicalScene(); |
3989 | 3979 | ||
3990 | Vector3 pos = AbsolutePosition; | 3980 | Vector3 pos = AbsolutePosition; |
3991 | if (AbsolutePosition.X < 0) | 3981 | float px = pos.X; |
3982 | if (px < 0) | ||
3992 | pos.X += Velocity.X * 2; | 3983 | pos.X += Velocity.X * 2; |
3993 | else if (AbsolutePosition.X > Constants.RegionSize) | 3984 | else if (px > m_scene.RegionInfo.RegionSizeX) |
3994 | pos.X -= Velocity.X * 2; | 3985 | pos.X -= Velocity.X * 2; |
3995 | if (AbsolutePosition.Y < 0) | 3986 | |
3987 | float py = pos.Y; | ||
3988 | if (py < 0) | ||
3996 | pos.Y += Velocity.Y * 2; | 3989 | pos.Y += Velocity.Y * 2; |
3997 | else if (AbsolutePosition.Y > Constants.RegionSize) | 3990 | else if (py > m_scene.RegionInfo.RegionSizeY) |
3998 | pos.Y -= Velocity.Y * 2; | 3991 | pos.Y -= Velocity.Y * 2; |
3992 | |||
3999 | Velocity = Vector3.Zero; | 3993 | Velocity = Vector3.Zero; |
4000 | AbsolutePosition = pos; | 3994 | AbsolutePosition = pos; |
4001 | 3995 | ||