change GetNewRezLocation physics ray results processing

avinationmerge
UbitUmarov 2015-10-01 14:47:32 +01:00
parent e110ca24cf
commit 2abe1ccc59
1 changed files with 38 additions and 21 deletions

View File

@ -2306,7 +2306,7 @@ namespace OpenSim.Region.Framework.Scenes
{
Vector3 direction = dir * (1 / dist);
dist += 2.0f;
dist += 1.0f;
if (SupportsRayCastFiltered())
{
@ -2323,16 +2323,24 @@ namespace OpenSim.Region.Framework.Scenes
(List<ContactResult>)RayCastFiltered(RayStart, direction, dist, physcount, rayfilter);
if (physresults != null && physresults.Count > 0)
{
if (physresults[0].ConsumerID == 0 || RayTargetID == UUID.Zero)
// look for terrain ?
if(RayTargetID == UUID.Zero)
{
// found something
pos = physresults[0].Normal * scale;
foreach (ContactResult r in physresults)
{
if (r.ConsumerID == 0)
{
pos = r.Normal * scale;
pos *= 0.5f;
pos = physresults[0].Pos + pos;
pos = r.Pos + pos;
if (wpos.Z > pos.Z) pos = wpos;
return pos;
}
}
}
else
{
foreach (ContactResult r in physresults)
{
SceneObjectPart part = GetSceneObjectPart(r.ConsumerID);
@ -2340,15 +2348,24 @@ namespace OpenSim.Region.Framework.Scenes
continue;
if (part.UUID == RayTargetID)
{
pos = physresults[0].Normal * scale;
pos = r.Normal * scale;
pos *= 0.5f;
pos = physresults[0].Pos + pos;
pos = r.Pos + pos;
if (wpos.Z > pos.Z) pos = wpos;
return pos;
}
}
}
// else the first we got
pos = physresults[0].Normal * scale;
pos *= 0.5f;
pos = physresults[0].Pos + pos;
if (wpos.Z > pos.Z)
pos = wpos;
return pos;
}
}
if (RayTargetID != UUID.Zero)