aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs42
1 files changed, 16 insertions, 26 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 8094e4c..d5d8629 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1759,7 +1759,7 @@ namespace OpenSim.Region.Environment.Scenes
1759 { 1759 {
1760 LLVector3 pos; 1760 LLVector3 pos;
1761 const bool frontFacesOnly = true; 1761 const bool frontFacesOnly = true;
1762 1762 //m_log.Info("HITTARGET: " + RayTargetObj.ToString() + ", COPYTARGET: " + localID.ToString());
1763 SceneObjectPart target = GetSceneObjectPart(localID); 1763 SceneObjectPart target = GetSceneObjectPart(localID);
1764 SceneObjectPart target2 = GetSceneObjectPart(RayTargetObj); 1764 SceneObjectPart target2 = GetSceneObjectPart(RayTargetObj);
1765 1765
@@ -1781,10 +1781,10 @@ namespace OpenSim.Region.Environment.Scenes
1781 Ray NewRay = new Ray(AXOrigin, AXdirection); 1781 Ray NewRay = new Ray(AXOrigin, AXdirection);
1782 1782
1783 // Ray Trace against target here 1783 // Ray Trace against target here
1784 EntityIntersection ei = target.TestIntersectionOBB(NewRay, new Quaternion(1, 0, 0, 0), frontFacesOnly, false); 1784 EntityIntersection ei = target2.TestIntersectionOBB(NewRay, new Quaternion(1, 0, 0, 0), frontFacesOnly, CopyCenters);
1785 1785
1786 // Un-comment out the following line to Get Raytrace results printed to the console. 1786 // Un-comment out the following line to Get Raytrace results printed to the console.
1787 // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); 1787 //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString());
1788 float ScaleOffset = 0.5f; 1788 float ScaleOffset = 0.5f;
1789 1789
1790 // If we hit something 1790 // If we hit something
@@ -1801,31 +1801,21 @@ namespace OpenSim.Region.Environment.Scenes
1801 LLVector3 offset = (normal * (ScaleOffset / 2f)); 1801 LLVector3 offset = (normal * (ScaleOffset / 2f));
1802 pos = (intersectionpoint + offset); 1802 pos = (intersectionpoint + offset);
1803 1803
1804 if (CopyCenters) 1804
1805 // stick in offset format from the original prim
1806 pos = pos - target.ParentGroup.AbsolutePosition;
1807 if (CopyRotates)
1805 { 1808 {
1806 // now we cast a ray from inside the prim(absolute position) to one of it's faces along the face normal. 1809 LLQuaternion worldRot = target2.GetWorldRotation();
1807 LLVector3 direction2 = LLVector3.Norm(pos - target2.AbsolutePosition);
1808 Vector3 AXOrigin2 = new Vector3(target2.AbsolutePosition.X, target2.AbsolutePosition.Y, target2.AbsolutePosition.Z);
1809 Vector3 AXdirection2 = new Vector3(direction2.X, direction2.Y, direction2.Z); //ei.AAfaceNormal;
1810 Ray NewRay2 = new Ray(AXOrigin2, AXdirection2);
1811 EntityIntersection ei2 = target.TestIntersectionOBB(NewRay2, new Quaternion(1, 0, 0, 0), false, CopyCenters);
1812 if (ei2.HitTF)
1813 {
1814 //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei2.HitTF.ToString() + " Point: " + ei2.ipoint.ToString() + " Normal: " + ei2.normal.ToString());
1815 pos = new LLVector3(ei2.ipoint.x,ei2.ipoint.y,ei2.ipoint.z);
1816 normal.X = ei2.normal.x;
1817 normal.Y = ei2.normal.y;
1818 normal.Z = ei2.normal.z;
1819 }
1820 }
1821
1822 // Set the position to the intersection point
1823 offset = (normal * (ScaleOffset / 2f));
1824 pos = (intersectionpoint + offset);
1825 1810
1826 // stick in offset format from the original prim 1811 SceneObjectGroup obj = m_innerScene.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, new Quaternion(worldRot.W,worldRot.X,worldRot.Y,worldRot.Z));
1827 pos = pos - target2.ParentGroup.AbsolutePosition; 1812 //obj.Rotation = new Quaternion(worldRot.W, worldRot.X, worldRot.Y, worldRot.Z);
1828 m_innerScene.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); 1813 //obj.UpdateGroupRotation(worldRot);
1814 }
1815 else
1816 {
1817 m_innerScene.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID);
1818 }
1829 } 1819 }
1830 1820
1831 return; 1821 return;