diff options
author | Teravus Ovares | 2008-05-01 15:17:49 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-01 15:17:49 +0000 |
commit | 56b4f5a2ea582d347c69ce30405e078270090dfa (patch) | |
tree | 088745a3b4457b58c95c1eec1de5d5299d3493e9 /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |
parent | * Assorted spring cleanings. (diff) | |
download | opensim-SC-56b4f5a2ea582d347c69ce30405e078270090dfa.zip opensim-SC-56b4f5a2ea582d347c69ce30405e078270090dfa.tar.gz opensim-SC-56b4f5a2ea582d347c69ce30405e078270090dfa.tar.bz2 opensim-SC-56b4f5a2ea582d347c69ce30405e078270090dfa.tar.xz |
* 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.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 23 |
1 files changed, 17 insertions, 6 deletions
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 | |||
1060 | return Math.Sqrt(dx * dx + dy * dy + dz * dz); | 1060 | return Math.Sqrt(dx * dx + dy * dy + dz * dz); |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool FrontFacesOnly) | 1063 | public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) |
1064 | { | 1064 | { |
1065 | // In this case we're using a rectangular prism, which has 6 faces and therefore 6 planes | 1065 | // In this case we're using a rectangular prism, which has 6 faces and therefore 6 planes |
1066 | // This breaks down into the ray---> plane equation. | 1066 | // This breaks down into the ray---> plane equation. |
@@ -1339,14 +1339,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
1339 | continue; | 1339 | continue; |
1340 | 1340 | ||
1341 | // If the normal is pointing outside the object | 1341 | // If the normal is pointing outside the object |
1342 | if (iray.Direction.Dot(normals[i]) < 0 || !FrontFacesOnly) | 1342 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) |
1343 | { | 1343 | { |
1344 | |||
1345 | q = iray.Origin + a * iray.Direction; | ||
1346 | 1344 | ||
1347 | // Is this the closest hit to the object's origin? | 1345 | if (faceCenters) |
1348 | //float distance2 = (float)GetDistanceTo(q, iray.Origin); | 1346 | { |
1347 | q = AXpos + a * AAfacenormals[i]; //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; | ||
1348 | } | ||
1349 | else | ||
1350 | { | ||
1351 | q = iray.Origin + a * iray.Direction; | ||
1352 | } | ||
1353 | |||
1349 | float distance2 = (float)GetDistanceTo(q, AXpos); | 1354 | float distance2 = (float)GetDistanceTo(q, AXpos); |
1355 | // Is this the closest hit to the object's origin? | ||
1356 | if (faceCenters) | ||
1357 | { | ||
1358 | distance2 = (float)GetDistanceTo(q, iray.Origin); | ||
1359 | } | ||
1360 | |||
1350 | 1361 | ||
1351 | if (distance2 < returnresult.distance) | 1362 | if (distance2 < returnresult.distance) |
1352 | { | 1363 | { |