diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 5 |
3 files changed, 18 insertions, 13 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e4e087f..eaaa9eb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -450,13 +450,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
450 | 450 | ||
451 | public LSL_Vector llVecNorm(LSL_Vector v) | 451 | public LSL_Vector llVecNorm(LSL_Vector v) |
452 | { | 452 | { |
453 | m_host.AddScriptLPS(1); | 453 | m_host.AddScriptLPS(1); |
454 | double mag = LSL_Vector.Mag(v); | 454 | return LSL_Vector.Norm(v); |
455 | LSL_Vector nor = new LSL_Vector(); | ||
456 | nor.x = v.x / mag; | ||
457 | nor.y = v.y / mag; | ||
458 | nor.z = v.z / mag; | ||
459 | return nor; | ||
460 | } | 455 | } |
461 | 456 | ||
462 | public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) | 457 | public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 1ea52c5..326f327 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -257,12 +257,17 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
257 | public static double Mag(Vector3 v) | 257 | public static double Mag(Vector3 v) |
258 | { | 258 | { |
259 | return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); | 259 | return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); |
260 | } | 260 | } |
261 | 261 | ||
262 | public static Vector3 Norm(Vector3 vector) | 262 | public static Vector3 Norm(Vector3 vector) |
263 | { | 263 | { |
264 | double mag = Mag(vector); | 264 | double mag = Mag(vector); |
265 | return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); | 265 | if (mag > 0.0) |
266 | { | ||
267 | double invMag = 1.0 / mag; | ||
268 | return vector * invMag; | ||
269 | } | ||
270 | return new Vector3(0, 0, 0); | ||
266 | } | 271 | } |
267 | 272 | ||
268 | #endregion | 273 | #endregion |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index f702e65..73ef570 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -488,6 +488,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
488 | 488 | ||
489 | if (stateSource == (int)StateSource.ScriptedRez) | 489 | if (stateSource == (int)StateSource.ScriptedRez) |
490 | { | 490 | { |
491 | lock (m_CompileDict) | ||
492 | { | ||
493 | m_CompileDict[itemID] = 0; | ||
494 | } | ||
495 | |||
491 | DoOnRezScript(parms); | 496 | DoOnRezScript(parms); |
492 | } | 497 | } |
493 | else | 498 | else |