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.
avinationmerge
Melanie 2013-01-23 20:58:47 +01:00
parent c75508ec8d
commit dd6ddcc7a5
1 changed files with 15 additions and 3 deletions

View File

@ -12287,12 +12287,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
// Double check this
if (checkTerrain) if (checkTerrain)
{
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); ContactResult? groundContact = GroundIntersection(rayStart, rayEnd);
if (groundContact != null) if (groundContact != null)
results.Add((ContactResult)groundContact); results.Add((ContactResult)groundContact);
} }
}
results.Sort(delegate(ContactResult a, ContactResult b) results.Sort(delegate(ContactResult a, ContactResult b)
{ {