diff options
author | Robert Adams | 2013-11-30 15:28:39 -0800 |
---|---|---|
committer | Robert Adams | 2013-11-30 15:28:39 -0800 |
commit | 6cd0d7a62b696d28d488f3cb82838ccf973ccfd7 (patch) | |
tree | 6b058a23eccf0eda55666abee9a3bb52c415e0ce /OpenSim/Region/Framework | |
parent | varregion: add ITerrainChannel.GetHeightAtXYZ() for eventual mesh terrain. (diff) | |
download | opensim-SC_OLD-6cd0d7a62b696d28d488f3cb82838ccf973ccfd7.zip opensim-SC_OLD-6cd0d7a62b696d28d488f3cb82838ccf973ccfd7.tar.gz opensim-SC_OLD-6cd0d7a62b696d28d488f3cb82838ccf973ccfd7.tar.bz2 opensim-SC_OLD-6cd0d7a62b696d28d488f3cb82838ccf973ccfd7.tar.xz |
varregion: Add MaxRegionSize constant and enforce in RegionInfo.
Intermediate checkin of changing border cross computation from checking
boundry limits to requests to GridService. Not totally functional.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 48 |
2 files changed, 61 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 99c7079..be8aed1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2483,6 +2483,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
2483 | EntityTransferModule.Cross(grp, attemptedPosition, silent); | 2483 | EntityTransferModule.Cross(grp, attemptedPosition, silent); |
2484 | } | 2484 | } |
2485 | 2485 | ||
2486 | // Simple test to see if a position is in the current region. | ||
2487 | // Resuming the position is relative to the region so anything outside its bounds. | ||
2488 | // Return 'true' if position inside region. | ||
2489 | public bool PositionIsInCurrentRegion(Vector3 pos) | ||
2490 | { | ||
2491 | bool ret = true; | ||
2492 | int xx = (int)Math.Floor(pos.X); | ||
2493 | int yy = (int)Math.Floor(pos.Y); | ||
2494 | if (xx < 0 | ||
2495 | || xx > RegionInfo.RegionSizeX | ||
2496 | || yy < 0 | ||
2497 | || yy > RegionInfo.RegionSizeY) | ||
2498 | ret = false; | ||
2499 | return ret; | ||
2500 | |||
2501 | } | ||
2502 | |||
2486 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) | 2503 | public Border GetCrossedBorder(Vector3 position, Cardinals gridline) |
2487 | { | 2504 | { |
2488 | if (BordersLocked) | 2505 | if (BordersLocked) |
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 | { |