diff options
author | Teravus Ovares | 2008-05-01 06:31:12 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-05-01 06:31:12 +0000 |
commit | 1c697ef0d206445c6819e338626169fc6ef56432 (patch) | |
tree | 88d6b26b5982eb73f75a5f051c2f068c1d8d8f27 /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |
parent | * Fix OBB raycaster to respond properly to rays cast from any direction. (diff) | |
download | opensim-SC-1c697ef0d206445c6819e338626169fc6ef56432.zip opensim-SC-1c697ef0d206445c6819e338626169fc6ef56432.tar.gz opensim-SC-1c697ef0d206445c6819e338626169fc6ef56432.tar.bz2 opensim-SC-1c697ef0d206445c6819e338626169fc6ef56432.tar.xz |
* You can now rez objects out of inventory at the correct offset from prim you rez it on. Including multi prim groups and prim that have different X/Y/Z scales.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 8d05987..5f91176 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1061,7 +1061,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1061 | return Math.Sqrt(dx * dx + dy * dy + dz * dz); | 1061 | return Math.Sqrt(dx * dx + dy * dy + dz * dz); |
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot) | 1064 | public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool FrontFacesOnly) |
1065 | { | 1065 | { |
1066 | // In this case we're using a rectangular prism, which has 6 faces and therefore 6 planes | 1066 | // In this case we're using a rectangular prism, which has 6 faces and therefore 6 planes |
1067 | // This breaks down into the ray---> plane equation. | 1067 | // This breaks down into the ray---> plane equation. |
@@ -1075,6 +1075,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1075 | Vector3[] FaceD = new Vector3[6]; // vertex D for Facei | 1075 | Vector3[] FaceD = new Vector3[6]; // vertex D for Facei |
1076 | 1076 | ||
1077 | Vector3[] normals = new Vector3[6]; // Normal for Facei | 1077 | Vector3[] normals = new Vector3[6]; // Normal for Facei |
1078 | Vector3[] AAfacenormals = new Vector3[6]; // Axis Aligned face normals | ||
1079 | |||
1080 | AAfacenormals[0] = new Vector3(1, 0, 0); | ||
1081 | AAfacenormals[1] = new Vector3(0, 1, 0); | ||
1082 | AAfacenormals[2] = new Vector3(-1, 0, 0); | ||
1083 | AAfacenormals[3] = new Vector3(0, -1, 0); | ||
1084 | AAfacenormals[4] = new Vector3(0, 0, 1); | ||
1085 | AAfacenormals[5] = new Vector3(0, 0, -1); | ||
1078 | 1086 | ||
1079 | Vector3 AmBa = new Vector3(0, 0, 0); // Vertex A - Vertex B | 1087 | Vector3 AmBa = new Vector3(0, 0, 0); // Vertex A - Vertex B |
1080 | Vector3 AmBb = new Vector3(0, 0, 0); // Vertex B - Vertex C | 1088 | Vector3 AmBb = new Vector3(0, 0, 0); // Vertex B - Vertex C |
@@ -1332,7 +1340,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1332 | continue; | 1340 | continue; |
1333 | 1341 | ||
1334 | // If the normal is pointing outside the object | 1342 | // If the normal is pointing outside the object |
1335 | if (iray.Direction.Dot(normals[i]) < 0) | 1343 | if (iray.Direction.Dot(normals[i]) < 0 || !FrontFacesOnly) |
1336 | { | 1344 | { |
1337 | 1345 | ||
1338 | q = iray.Origin + a * iray.Direction; | 1346 | q = iray.Origin + a * iray.Direction; |
@@ -1349,6 +1357,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1349 | //m_log.Info("[FACE]:" + i.ToString()); | 1357 | //m_log.Info("[FACE]:" + i.ToString()); |
1350 | //m_log.Info("[POINT]: " + q.ToString()); | 1358 | //m_log.Info("[POINT]: " + q.ToString()); |
1351 | returnresult.normal = normals[i]; | 1359 | returnresult.normal = normals[i]; |
1360 | returnresult.AAfaceNormal = AAfacenormals[i]; | ||
1352 | 1361 | ||
1353 | } | 1362 | } |
1354 | } | 1363 | } |