oops bug fix

melanie
UbitUmarov 2016-11-06 04:29:01 +00:00
parent 014cd1ab42
commit 6956ada5e8
1 changed files with 29 additions and 19 deletions

View File

@ -14519,7 +14519,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Vector3 rayEnd = end; Vector3 rayEnd = end;
Vector3 dir = rayEnd - rayStart; Vector3 dir = rayEnd - rayStart;
float dist = Vector3.Mag(dir); float dist = dir.Length();
int count = 1; int count = 1;
bool detectPhantom = false; bool detectPhantom = false;
@ -14581,14 +14581,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
object physresults; object physresults;
physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter); physresults = World.RayCastFiltered(rayStart, direction, dist, physcount, rayfilter);
/*
if (physresults == null) if (physresults == null)
{ {
list.Add(new LSL_Integer(-3)); // timeout error // list.Add(new LSL_Integer(-3)); // timeout error
return list; // return list;
results = new List<ContactResult>();
} }
*/ else
results = (List<ContactResult>)physresults; results = (List<ContactResult>)physresults;
// for now physics doesn't detect sitted avatars so do it outside physics // for now physics doesn't detect sitted avatars so do it outside physics
if (checkAgents) if (checkAgents)
@ -14609,6 +14609,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
foreach (ContactResult r in objectHits) foreach (ContactResult r in objectHits)
results.Add(r); 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 else
{ {
@ -14629,20 +14651,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
results.Add(objectHits[iter]); results.Add(objectHits[iter]);
} }
} }
}
// 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)