From 1ecd803e87119c0344b91798792130155a82859c Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 23 Nov 2007 05:56:35 +0000 Subject: * added some functions for use in raytracing. They're kind of crappy now, so they only display 'guesses' on the console when you rez a prim. * any math gurus who'd like to improve rezzing need only to make the raytracer in SceneObjectPart work :D --- .../Region/Environment/Scenes/SceneObjectGroup.cs | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 474d434..45581c5 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -353,6 +353,44 @@ namespace OpenSim.Region.Environment.Scenes } } + public EntityIntersection testIntersection(Ray hRay) + { + EntityIntersection returnresult = new EntityIntersection(); + bool gothit = false; + foreach (SceneObjectPart part in m_parts.Values) + { + SceneObjectPart returnThisPart = null; + Vector3 partPosition = new Vector3(part.AbsolutePosition.X,part.AbsolutePosition.Y,part.AbsolutePosition.Z); + Quaternion parentrotation = new Quaternion(GroupRotation.W,GroupRotation.X,GroupRotation.Y,GroupRotation.Z); + EntityIntersection inter = part.testIntersection(hRay,parentrotation); + + float idist = 256f; + + + + + if (inter.HitTF) { + // We need to find the closest prim to return to the testcaller along the ray + if (inter.distance < idist) { + + idist = inter.distance; + returnresult.HitTF = true; + returnresult.ipoint = inter.ipoint; + returnresult.obj = part; + returnresult.normal = inter.normal; + returnresult.distance = inter.distance; + gothit = true; + } + } + + + } + return returnresult; + + } + + + /// /// /// -- cgit v1.1