aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorUbitUmarov2016-11-06 03:53:12 +0000
committerUbitUmarov2016-11-06 03:53:12 +0000
commit014cd1ab428feff96484c666694c33822344269e (patch)
tree5c20753e4f1613d69f1a3aa7b1e2d80ce82248b1 /OpenSim/Region/ScriptEngine/Shared
parentchange llGetTime() source clock (diff)
downloadopensim-SC_OLD-014cd1ab428feff96484c666694c33822344269e.zip
opensim-SC_OLD-014cd1ab428feff96484c666694c33822344269e.tar.gz
opensim-SC_OLD-014cd1ab428feff96484c666694c33822344269e.tar.bz2
opensim-SC_OLD-014cd1ab428feff96484c666694c33822344269e.tar.xz
restrict ubOde castray with terrain range only on horizontal plane, let it find physical avatars.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs20
1 files changed, 12 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 02a9ebc..33d5757 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -14216,18 +14216,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14216 return false; 14216 return false;
14217 } 14217 }
14218 14218
14219 private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd) 14219 private ContactResult[] AvatarIntersection(Vector3 rayStart, Vector3 rayEnd, bool skipPhys)
14220 { 14220 {
14221 List<ContactResult> contacts = new List<ContactResult>(); 14221 List<ContactResult> contacts = new List<ContactResult>();
14222 14222
14223 Vector3 ab = rayEnd - rayStart; 14223 Vector3 ab = rayEnd - rayStart;
14224 float ablen = ab.Length();
14224 14225
14225 World.ForEachScenePresence(delegate(ScenePresence sp) 14226 World.ForEachScenePresence(delegate(ScenePresence sp)
14226 { 14227 {
14228 if(skipPhys && sp.PhysicsActor != null)
14229 return;
14230
14227 Vector3 ac = sp.AbsolutePosition - rayStart; 14231 Vector3 ac = sp.AbsolutePosition - rayStart;
14228// Vector3 bc = sp.AbsolutePosition - rayEnd;
14229 14232
14230 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); 14233 double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / ablen);
14231 14234
14232 if (d > 1.5) 14235 if (d > 1.5)
14233 return; 14236 return;
@@ -14553,8 +14556,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14553 RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull; 14556 RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull;
14554 if (checkTerrain) 14557 if (checkTerrain)
14555 rayfilter |= RayFilterFlags.land; 14558 rayfilter |= RayFilterFlags.land;
14556// if (checkAgents) 14559 if (checkAgents)
14557// rayfilter |= RayFilterFlags.agent; 14560 rayfilter |= RayFilterFlags.agent;
14558 if (checkPhysical) 14561 if (checkPhysical)
14559 rayfilter |= RayFilterFlags.physical; 14562 rayfilter |= RayFilterFlags.physical;
14560 if (checkNonPhysical) 14563 if (checkNonPhysical)
@@ -14578,18 +14581,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14578 object physresults; 14581 object physresults;
14579 physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter); 14582 physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter);
14580 14583
14584/*
14581 if (physresults == null) 14585 if (physresults == null)
14582 { 14586 {
14583 list.Add(new LSL_Integer(-3)); // timeout error 14587 list.Add(new LSL_Integer(-3)); // timeout error
14584 return list; 14588 return list;
14585 } 14589 }
14586 14590*/
14587 results = (List<ContactResult>)physresults; 14591 results = (List<ContactResult>)physresults;
14588 14592
14589 // for now physics doesn't detect sitted avatars so do it outside physics 14593 // for now physics doesn't detect sitted avatars so do it outside physics
14590 if (checkAgents) 14594 if (checkAgents)
14591 { 14595 {
14592 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); 14596 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, true);
14593 foreach (ContactResult r in agentHits) 14597 foreach (ContactResult r in agentHits)
14594 results.Add(r); 14598 results.Add(r);
14595 } 14599 }
@@ -14610,7 +14614,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
14610 { 14614 {
14611 if (checkAgents) 14615 if (checkAgents)
14612 { 14616 {
14613 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd); 14617 ContactResult[] agentHits = AvatarIntersection(rayStart, rayEnd, false);
14614 foreach (ContactResult r in agentHits) 14618 foreach (ContactResult r in agentHits)
14615 results.Add(r); 14619 results.Add(r);
14616 } 14620 }