From 6956ada5e83d1d1ebcedef6c6154925e8efd501d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 6 Nov 2016 04:29:01 +0000 Subject: oops bug fix --- .../Shared/Api/Implementation/LSL_Api.cs | 48 +++++++++++++--------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 33d5757..1a73c3e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -14519,7 +14519,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Vector3 rayEnd = end; Vector3 dir = rayEnd - rayStart; - float dist = Vector3.Mag(dir); + float dist = dir.Length(); int count = 1; bool detectPhantom = false; @@ -14581,14 +14581,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object physresults; physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter); -/* if (physresults == null) { - list.Add(new LSL_Integer(-3)); // timeout error - return list; +// list.Add(new LSL_Integer(-3)); // timeout error +// return list; + results = new List(); } -*/ - results = (List)physresults; + else + results = (List)physresults; // for now physics doesn't detect sitted avatars so do it outside physics if (checkAgents) @@ -14609,6 +14609,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (ContactResult r in objectHits) results.Add(r); } + // Double check this because of current ODE distance problems + if (checkTerrain && dist > 60) + { + bool skipGroundCheck = false; + + foreach (ContactResult c in results) + { + if (c.ConsumerID == 0) // Physics gave us a ground collision + skipGroundCheck = true; + } + + if (!skipGroundCheck) + { + float tmp = dir.X * dir.X + dir.Y * dir.Y; + if(tmp > 2500) + { + ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); + if (groundContact != null) + results.Add((ContactResult)groundContact); + } + } + } } else { @@ -14629,20 +14651,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api results.Add(objectHits[iter]); } } - } - - // Double check this - if (checkTerrain) - { - bool skipGroundCheck = false; - - foreach (ContactResult c in results) - { - if (c.ConsumerID == 0) // Physics gave us a ground collision - skipGroundCheck = true; - } - if (!skipGroundCheck) + if (checkTerrain) { ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); if (groundContact != null) -- cgit v1.1