aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-19 17:00:17 +0000
committerMelanie Thielker2008-09-19 17:00:17 +0000
commit592f98c4aaa5265a31c481a49cfc7afb49590da3 (patch)
tree27a3509ff0fa9039e394f0f079cab400fc0126b9 /OpenSim/Region/ScriptEngine/Common
parentFix issue introduces by a fix in 6256. Fixes mantis #2214 (diff)
downloadopensim-SC-592f98c4aaa5265a31c481a49cfc7afb49590da3.zip
opensim-SC-592f98c4aaa5265a31c481a49cfc7afb49590da3.tar.gz
opensim-SC-592f98c4aaa5265a31c481a49cfc7afb49590da3.tar.bz2
opensim-SC-592f98c4aaa5265a31c481a49cfc7afb49590da3.tar.xz
Mantis #2217
Guard against NaN being returned from llRotBetween. Return a zero rotation if the result is NaN.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 2eb50ef..dbb61fd 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -562,7 +562,15 @@ namespace OpenSim.Region.ScriptEngine.Common
562 LSL_Types.Vector3 axis = LSL_Types.Vector3.Norm(crossProduct); 562 LSL_Types.Vector3 axis = LSL_Types.Vector3.Norm(crossProduct);
563 double s = Math.Sin(angle / 2); 563 double s = Math.Sin(angle / 2);
564 564
565 return new LSL_Types.Quaternion(axis.x * s, axis.y * s, axis.z * s, (float)Math.Cos(angle / 2)); 565 double x = axis.x * s;
566 double y = axis.y * s;
567 double z = axis.z * s;
568 double w = Math.Cos(angle / 2);
569
570 if(Double.IsNaN(x) || Double.IsNaN(y) || Double.IsNaN(z) || Double.IsNaN(w))
571 return new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
572
573 return new LSL_Types.Quaternion((float)x, (float)y, (float)z, (float)w);
566 } 574 }
567 575
568 public void llWhisper(int channelID, string text) 576 public void llWhisper(int channelID, string text)