From e11e6dc308a01a1f76f755157e9e91027d172a52 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 25 Mar 2008 17:28:09 +0000 Subject: * Use Face normal to offset new prim instead of the hard coded pos.Z += 0.25f; This allows proper positioning of prim based on the face you click. ( Yes, you can click the bottom face of a prim that's above you, and the new prim appears directly below it. ) --- OpenSim/Region/Environment/Scenes/Scene.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 75f8c23..c74092a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1087,13 +1087,17 @@ namespace OpenSim.Region.Environment.Scenes EntityIntersection ei = target.TestIntersectionOBB(NewRay, new Quaternion(1,0,0,0)); // Un-comment out the following line to Get Raytrace results printed to the console. - //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); + m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); // If we hit something if (ei.HitTF) { // Set the position to the intersection point - pos = new LLVector3(ei.ipoint.x, ei.ipoint.y, ei.ipoint.z); + pos = (new LLVector3(ei.ipoint.x, ei.ipoint.y, ei.ipoint.z) + (new LLVector3(ei.normal.x,ei.normal.x,ei.normal.z) * (0.5f/2f))); + + // Un-offset the prim (it gets offset later by the consumer method) + pos.Z -= 0.25F; + } -- cgit v1.1