aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs12
1 files changed, 5 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index cf084d6..834f8fb 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2284,14 +2284,16 @@ namespace OpenSim.Region.Framework.Scenes
2284 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 2284 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
2285 { 2285 {
2286 2286
2287 Vector3 dir = RayEnd - RayStart;
2288
2287 float wheight = (float)RegionInfo.RegionSettings.WaterHeight; 2289 float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
2288 Vector3 wpos = Vector3.Zero; 2290 Vector3 wpos = Vector3.Zero;
2289 // Check for water surface intersection from above 2291 // Check for water surface intersection from above
2290 if ((RayStart.Z > wheight) && (RayEnd.Z < wheight)) 2292 if ((RayStart.Z > wheight) && (RayEnd.Z < wheight))
2291 { 2293 {
2292 float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z); 2294 float ratio = (wheight - RayStart.Z) / dir.Z;
2293 wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X)); 2295 wpos.X = RayStart.X + (ratio * dir.X);
2294 wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y)); 2296 wpos.Y = RayStart.Y + (ratio * dir.Y);
2295 wpos.Z = wheight; 2297 wpos.Z = wheight;
2296 } 2298 }
2297 2299
@@ -2299,9 +2301,6 @@ namespace OpenSim.Region.Framework.Scenes
2299 2301
2300 if (RayEndIsIntersection != (byte)1) 2302 if (RayEndIsIntersection != (byte)1)
2301 { 2303 {
2302 Vector3 rayEnd = RayEnd;
2303
2304 Vector3 dir = rayEnd - RayStart;
2305 float dist = dir.Length(); 2304 float dist = dir.Length();
2306 if (dist != 0) 2305 if (dist != 0)
2307 { 2306 {
@@ -2415,7 +2414,6 @@ namespace OpenSim.Region.Framework.Scenes
2415 } 2414 }
2416 } 2415 }
2417 } 2416 }
2418
2419 } 2417 }
2420 2418
2421 // fall back to our stupid functionality 2419 // fall back to our stupid functionality