missed a Math.sqrt ...

LSLKeyTest
UbitUmarov 2016-08-01 04:48:01 +01:00
parent 708d2cd413
commit 4ba4c9cf9e
1 changed files with 4 additions and 4 deletions

View File

@ -6394,7 +6394,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(dir.x == 0.0 && dir.y == 0.0) if(dir.x == 0 && dir.y == 0)
return 1; // SL wiki return 1; // SL wiki
float rsx = World.RegionInfo.RegionSizeX; float rsx = World.RegionInfo.RegionSizeX;
@ -6409,9 +6409,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (dir.x == 0) if (dir.x == 0)
{ {
ex = px; ex = px;
ey = dir.y > 0.0 ? rsy + 1.0f : -1.0f; ey = dir.y > 0 ? rsy + 1.0f : -1.0f;
} }
else if(dir.y == 0.0f) else if(dir.y == 0)
{ {
ex = dir.x > 0 ? rsx + 1.0f : -1.0f; ex = dir.x > 0 ? rsx + 1.0f : -1.0f;
ey = py; ey = py;
@ -6422,6 +6422,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
float dy = (float) dir.y; float dy = (float) dir.y;
float t1 = dx * dx + dy * dy; float t1 = dx * dx + dy * dy;
t1 = (float)Math.Sqrt(t1);
dx /= t1; dx /= t1;
dy /= t1; dy /= t1;
@ -6430,7 +6431,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else else
t1 = -(px + 1f)/dx; t1 = -(px + 1f)/dx;
float t2; float t2;
if(dy > 0) if(dy > 0)
t2 = (rsy + 1f - py)/dy; t2 = (rsy + 1f - py)/dy;