aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs21
1 files changed, 17 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 667cc09..1be2776 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -12091,12 +12091,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12091 radius = Math.Abs(maxY); 12091 radius = Math.Abs(maxY);
12092 if (Math.Abs(maxZ) > radius) 12092 if (Math.Abs(maxZ) > radius)
12093 radius = Math.Abs(maxZ); 12093 radius = Math.Abs(maxZ);
12094 12094 radius = radius*1.413f;
12095 Vector3 ac = group.AbsolutePosition - rayStart; 12095 Vector3 ac = group.AbsolutePosition - rayStart;
12096 Vector3 bc = group.AbsolutePosition - rayEnd; 12096 Vector3 bc = group.AbsolutePosition - rayEnd;
12097 12097
12098 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); 12098 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
12099 12099
12100 // Too far off ray, don't bother 12100 // Too far off ray, don't bother
12101 if (d > radius) 12101 if (d > radius)
12102 return; 12102 return;
@@ -12106,11 +12106,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12106 if (d2 > 0) 12106 if (d2 > 0)
12107 return; 12107 return;
12108 12108
12109 ray = new Ray(rayStart, Vector3.Normalize(rayEnd - rayStart));
12109 EntityIntersection intersection = group.TestIntersection(ray, true, false); 12110 EntityIntersection intersection = group.TestIntersection(ray, true, false);
12110 // Miss. 12111 // Miss.
12111 if (!intersection.HitTF) 12112 if (!intersection.HitTF)
12112 return; 12113 return;
12113 12114
12115 Vector3 b1 = group.AbsolutePosition + new Vector3(minX, minY, minZ);
12116 Vector3 b2 = group.AbsolutePosition + new Vector3(maxX, maxY, maxZ);
12117 //m_log.DebugFormat("[LLCASTRAY]: min<{0},{1},{2}>, max<{3},{4},{5}> = hitp<{6},{7},{8}>", b1.X,b1.Y,b1.Z,b2.X,b2.Y,b2.Z,intersection.ipoint.X,intersection.ipoint.Y,intersection.ipoint.Z);
12118 if (!(intersection.ipoint.X >= b1.X && intersection.ipoint.X <= b2.X &&
12119 intersection.ipoint.Y >= b1.Y && intersection.ipoint.Y <= b2.Y &&
12120 intersection.ipoint.Z >= b1.Z && intersection.ipoint.Z <= b2.Z))
12121 return;
12122
12114 ContactResult result = new ContactResult (); 12123 ContactResult result = new ContactResult ();
12115 result.ConsumerID = group.LocalId; 12124 result.ConsumerID = group.LocalId;
12116// result.Depth = intersection.distance; 12125// result.Depth = intersection.distance;
@@ -12384,8 +12393,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
12384 if (checkPhysical || checkNonPhysical || detectPhantom) 12393 if (checkPhysical || checkNonPhysical || detectPhantom)
12385 { 12394 {
12386 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom); 12395 ContactResult[] objectHits = ObjectIntersection(rayStart, rayEnd, checkPhysical, checkNonPhysical, detectPhantom);
12387 foreach (ContactResult r in objectHits) 12396 for (int iter = 0; iter < objectHits.Length; iter++)
12388 results.Add(r); 12397 {
12398 // Redistance the Depth because the Scene RayCaster returns distance from center to make the rezzing code simpler.
12399 objectHits[iter].Depth = Vector3.Distance(objectHits[iter].Pos, rayStart);
12400 results.Add(objectHits[iter]);
12401 }
12389 } 12402 }
12390 } 12403 }
12391 12404