From 56b4f5a2ea582d347c69ce30405e078270090dfa Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Thu, 1 May 2008 15:17:49 +0000 Subject: * committing what I've got so far for DuplicateOnRay so I don't fight the conflict monster later. Not done yet, doesn't crash the server. --- .../Region/Environment/Scenes/SceneObjectPart.cs | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 18cae48..3dbd809 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1060,7 +1060,7 @@ namespace OpenSim.Region.Environment.Scenes return Math.Sqrt(dx * dx + dy * dy + dz * dz); } - public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool FrontFacesOnly) + public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) { // In this case we're using a rectangular prism, which has 6 faces and therefore 6 planes // This breaks down into the ray---> plane equation. @@ -1339,14 +1339,25 @@ namespace OpenSim.Region.Environment.Scenes continue; // If the normal is pointing outside the object - if (iray.Direction.Dot(normals[i]) < 0 || !FrontFacesOnly) + if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) { - - q = iray.Origin + a * iray.Direction; - // Is this the closest hit to the object's origin? - //float distance2 = (float)GetDistanceTo(q, iray.Origin); + if (faceCenters) + { + q = AXpos + a * AAfacenormals[i]; //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; + } + else + { + q = iray.Origin + a * iray.Direction; + } + float distance2 = (float)GetDistanceTo(q, AXpos); + // Is this the closest hit to the object's origin? + if (faceCenters) + { + distance2 = (float)GetDistanceTo(q, iray.Origin); + } + if (distance2 < returnresult.distance) { -- cgit v1.1