aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs32
1 files changed, 21 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ef662f3..97de147 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1948,14 +1948,24 @@ namespace OpenSim.Region.Framework.Scenes
1948 /// <returns></returns> 1948 /// <returns></returns>
1949 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter) 1949 public Vector3 GetNewRezLocation(Vector3 RayStart, Vector3 RayEnd, UUID RayTargetID, Quaternion rot, byte bypassRayCast, byte RayEndIsIntersection, bool frontFacesOnly, Vector3 scale, bool FaceCenter)
1950 { 1950 {
1951
1952 float wheight = (float)RegionInfo.RegionSettings.WaterHeight;
1953 Vector3 wpos = Vector3.Zero;
1954 // Check for water surface intersection from above
1955 if ( (RayStart.Z > wheight) && (RayEnd.Z < wheight) )
1956 {
1957 float ratio = (RayStart.Z - wheight) / (RayStart.Z - RayEnd.Z);
1958 wpos.X = RayStart.X - (ratio * (RayStart.X - RayEnd.X));
1959 wpos.Y = RayStart.Y - (ratio * (RayStart.Y - RayEnd.Y));
1960 wpos.Z = wheight;
1961 }
1962
1951 Vector3 pos = Vector3.Zero; 1963 Vector3 pos = Vector3.Zero;
1952 if (RayEndIsIntersection == (byte)1) 1964 if (RayEndIsIntersection == (byte)1)
1953 { 1965 {
1954 pos = RayEnd; 1966 pos = RayEnd;
1955 return pos;
1956 } 1967 }
1957 1968 else if (RayTargetID != UUID.Zero)
1958 if (RayTargetID != UUID.Zero)
1959 { 1969 {
1960 SceneObjectPart target = GetSceneObjectPart(RayTargetID); 1970 SceneObjectPart target = GetSceneObjectPart(RayTargetID);
1961 1971
@@ -1977,7 +1987,7 @@ namespace OpenSim.Region.Framework.Scenes
1977 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); 1987 EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter);
1978 1988
1979 // Un-comment out the following line to Get Raytrace results printed to the console. 1989 // Un-comment out the following line to Get Raytrace results printed to the console.
1980 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 1990 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
1981 float ScaleOffset = 0.5f; 1991 float ScaleOffset = 0.5f;
1982 1992
1983 // If we hit something 1993 // If we hit something
@@ -2000,13 +2010,10 @@ namespace OpenSim.Region.Framework.Scenes
2000 //pos.Z -= 0.25F; 2010 //pos.Z -= 0.25F;
2001 2011
2002 } 2012 }
2003
2004 return pos;
2005 } 2013 }
2006 else 2014 else
2007 { 2015 {
2008 // We don't have a target here, so we're going to raytrace all the objects in the scene. 2016 // We don't have a target here, so we're going to raytrace all the objects in the scene.
2009
2010 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false); 2017 EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection), true, false);
2011 2018
2012 // Un-comment the following line to print the raytrace results to the console. 2019 // Un-comment the following line to print the raytrace results to the console.
@@ -2015,13 +2022,12 @@ namespace OpenSim.Region.Framework.Scenes
2015 if (ei.HitTF) 2022 if (ei.HitTF)
2016 { 2023 {
2017 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2024 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
2018 } else 2025 }
2026 else
2019 { 2027 {
2020 // fall back to our stupid functionality 2028 // fall back to our stupid functionality
2021 pos = RayEnd; 2029 pos = RayEnd;
2022 } 2030 }
2023
2024 return pos;
2025 } 2031 }
2026 } 2032 }
2027 else 2033 else
@@ -2032,8 +2038,12 @@ namespace OpenSim.Region.Framework.Scenes
2032 //increase height so its above the ground. 2038 //increase height so its above the ground.
2033 //should be getting the normal of the ground at the rez point and using that? 2039 //should be getting the normal of the ground at the rez point and using that?
2034 pos.Z += scale.Z / 2f; 2040 pos.Z += scale.Z / 2f;
2035 return pos; 2041// return pos;
2036 } 2042 }
2043
2044 // check against posible water intercept
2045 if (wpos.Z > pos.Z) pos = wpos;
2046 return pos;
2037 } 2047 }
2038 2048
2039 2049