From dd6ddcc7a53565cc540def336c5b4bd2307a1d63 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 23 Jan 2013 20:58:47 +0100 Subject: [PATCH] Prevent double ground collisions and prefer the physics result if there is one. ODE is known to not see the ground sometimes on raycast so the double test is needed. --- .../Shared/Api/Implementation/LSL_Api.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 703c54d2db..a8763ea992 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -12287,11 +12287,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + // Double check this if (checkTerrain) { - ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); - if (groundContact != null) - results.Add((ContactResult)groundContact); + bool skipGroundCheck = false; + + foreach (ContactResult c in results) + { + if (c.ConsumerID == 0) // Physics gave us a ground collision + skipGroundCheck = true; + } + + if (!skipGroundCheck) + { + ContactResult? groundContact = GroundIntersection(rayStart, rayEnd); + if (groundContact != null) + results.Add((ContactResult)groundContact); + } } results.Sort(delegate(ContactResult a, ContactResult b)