don't mess ray direction..

avinationmerge
UbitUmarov 2015-09-24 06:57:53 +01:00
parent af34bfddd1
commit 58daecfccb
1 changed files with 77 additions and 73 deletions

View File

@ -2305,10 +2305,13 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 rayEnd = RayEnd; Vector3 rayEnd = RayEnd;
Vector3 dir = rayEnd - RayStart; Vector3 dir = rayEnd - RayStart;
float dist = Vector3.Mag(dir) + 2.0f; float dist = dir.Length();
if (dist != 0)
{
Vector3 direction = dir * (1 / dist); Vector3 direction = dir * (1 / dist);
dist += 2.0f;
if (SupportsRayCastFiltered()) if (SupportsRayCastFiltered())
{ {
RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull; RayFilterFlags rayfilter = RayFilterFlags.BackFaceCull;
@ -2327,9 +2330,9 @@ namespace OpenSim.Region.Framework.Scenes
if (physresults[0].ConsumerID == 0 || RayTargetID == UUID.Zero) if (physresults[0].ConsumerID == 0 || RayTargetID == UUID.Zero)
{ {
// found something // found something
pos = physresults[0].Normal * scale ; pos = physresults[0].Normal * scale;
pos *= 0.5f; pos *= 0.5f;
pos = physresults[0].Pos +pos; pos = physresults[0].Pos + pos;
return pos; return pos;
} }
foreach (ContactResult r in physresults) foreach (ContactResult r in physresults)
@ -2346,6 +2349,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
} }
if (RayTargetID != UUID.Zero) if (RayTargetID != UUID.Zero)
{ {
@ -2404,7 +2408,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
}
else else
{ {
// fall back to our stupid functionality // fall back to our stupid functionality