aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs16
1 files changed, 15 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index b53f6c0..3ae1f3a 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -430,7 +430,21 @@ namespace OpenSim.Region.ScriptEngine.Common
430 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r) 430 public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r)
431 { 431 {
432 m_host.AddScriptLPS(1); 432 m_host.AddScriptLPS(1);
433 return (new LSL_Types.Vector3(1,0,0) * r); 433 double x,y,z,m;
434 m = Math.Sqrt(r.x*r.x+r.y*r.y+r.z*r.z+r.s*r.s);
435 // m is always greater than zero
436 if (m!=1) // if m is not equal to 1 then Rotation needs to be normalized
437 {
438 r.x/=m;
439 r.y/=m;
440 r.z/=m;
441 r.s/=m;
442 }
443 // Fast Algebric Calculations instead of Vectors & Quaternions Product
444 x = r.x*r.x-r.y*r.y-r.z*r.z+r.s*r.s;
445 y = 2*(r.x*r.y+r.z*r.s);
446 z = 2*(r.x*r.z-r.y*r.s);
447 return (new LSL_Types.Vector3(x,y,z));
434 } 448 }
435 449
436 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r) 450 public LSL_Types.Vector3 llRot2Left(LSL_Types.Quaternion r)