diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 2c64c85..e827229 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3123,6 +3123,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3123 | int neighbor = 0; | 3123 | int neighbor = 0; |
3124 | int[] fix = new int[2]; | 3124 | int[] fix = new int[2]; |
3125 | 3125 | ||
3126 | // Compute the avatar position in the next physics tick. | ||
3127 | // If the avatar will be crossing, we force the crossing to happen now | ||
3128 | // in the hope that this will make the avatar movement smoother when crossing. | ||
3126 | float timeStep = 0.1f; | 3129 | float timeStep = 0.1f; |
3127 | pos2.X = pos2.X + (vel.X * timeStep); | 3130 | pos2.X = pos2.X + (vel.X * timeStep); |
3128 | pos2.Y = pos2.Y + (vel.Y * timeStep); | 3131 | pos2.Y = pos2.Y + (vel.Y * timeStep); |
@@ -3130,12 +3133,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
3130 | 3133 | ||
3131 | if (!IsInTransit) | 3134 | if (!IsInTransit) |
3132 | { | 3135 | { |
3133 | // m_log.DebugFormat( | 3136 | m_log.DebugFormat( |
3134 | // "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}", | 3137 | "[SCENE PRESENCE]: Testing border check for projected position {0} of {1} in {2}", |
3135 | // pos2, Name, Scene.Name); | 3138 | pos2, Name, Scene.Name); |
3139 | |||
3140 | if (!m_scene.PositionIsInCurrentRegion(pos2)) | ||
3141 | { | ||
3142 | // Disconnect from the current region | ||
3143 | bool isFlying = Flying; | ||
3144 | RemoveFromPhysicalScene(); | ||
3145 | // pos2 is the forcasted position so make that the 'current' position so the crossing | ||
3146 | // code will move us into the newly addressed region. | ||
3147 | m_pos = pos2; | ||
3148 | if (CrossToNewRegion()) | ||
3149 | { | ||
3150 | AddToPhysicalScene(isFlying); | ||
3151 | } | ||
3152 | else | ||
3153 | { | ||
3154 | // Tried to make crossing happen but it failed. | ||
3155 | if (m_requestedSitTargetUUID == UUID.Zero) | ||
3156 | { | ||
3157 | |||
3158 | Vector3 pos = AbsolutePosition; | ||
3159 | if (AbsolutePosition.X < 0) | ||
3160 | pos.X += Velocity.X * 2; | ||
3161 | else if (AbsolutePosition.X > m_scene.RegionInfo.RegionSizeX) | ||
3162 | pos.X -= Velocity.X * 2; | ||
3163 | if (AbsolutePosition.Y < 0) | ||
3164 | pos.Y += Velocity.Y * 2; | ||
3165 | else if (AbsolutePosition.Y > m_scene.RegionInfo.RegionSizeY) | ||
3166 | pos.Y -= Velocity.Y * 2; | ||
3167 | Velocity = Vector3.Zero; | ||
3168 | AbsolutePosition = pos; | ||
3169 | |||
3170 | AddToPhysicalScene(isFlying); | ||
3171 | } | ||
3172 | } | ||
3173 | |||
3174 | } | ||
3136 | 3175 | ||
3176 | /* | ||
3137 | // Checks if where it's headed exists a region | 3177 | // Checks if where it's headed exists a region |
3138 | bool needsTransit = false; | ||
3139 | if (m_scene.TestBorderCross(pos2, Cardinals.W)) | 3178 | if (m_scene.TestBorderCross(pos2, Cardinals.W)) |
3140 | { | 3179 | { |
3141 | if (m_scene.TestBorderCross(pos2, Cardinals.S)) | 3180 | if (m_scene.TestBorderCross(pos2, Cardinals.S)) |
@@ -3236,6 +3275,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3236 | } | 3275 | } |
3237 | } | 3276 | } |
3238 | } | 3277 | } |
3278 | */ | ||
3239 | } | 3279 | } |
3240 | else | 3280 | else |
3241 | { | 3281 | { |