aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAdam Frisby2008-03-11 16:19:01 +0000
committerAdam Frisby2008-03-11 16:19:01 +0000
commit11ba471bcc68f9fc625b3f442adefc9aa2d79a49 (patch)
tree55e70db41a1f0a0323b2b8a716d5143ae370247e
parent* Applying patch from Mantis #607 - Grid Server crash. Thanks Diva. (diff)
downloadopensim-SC_OLD-11ba471bcc68f9fc625b3f442adefc9aa2d79a49.zip
opensim-SC_OLD-11ba471bcc68f9fc625b3f442adefc9aa2d79a49.tar.gz
opensim-SC_OLD-11ba471bcc68f9fc625b3f442adefc9aa2d79a49.tar.bz2
opensim-SC_OLD-11ba471bcc68f9fc625b3f442adefc9aa2d79a49.tar.xz
* Applying patch #754 - Fix for Vector Magnitude operation. Thanks cmickeyb!
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs4
1 files changed, 2 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index b744ee4..e332f0f 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -191,13 +191,13 @@ namespace OpenSim.Region.ScriptEngine.Common
191 public double llVecMag(LSL_Types.Vector3 v) 191 public double llVecMag(LSL_Types.Vector3 v)
192 { 192 {
193 m_host.AddScriptLPS(1); 193 m_host.AddScriptLPS(1);
194 return (v.x * v.x + v.y * v.y + v.z * v.z); 194 return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
195 } 195 }
196 196
197 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) 197 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
198 { 198 {
199 m_host.AddScriptLPS(1); 199 m_host.AddScriptLPS(1);
200 double mag = v.x * v.x + v.y * v.y + v.z * v.z; 200 double mag = Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
201 LSL_Types.Vector3 nor = new LSL_Types.Vector3(); 201 LSL_Types.Vector3 nor = new LSL_Types.Vector3();
202 nor.x = v.x / mag; 202 nor.x = v.x / mag;
203 nor.y = v.y / mag; 203 nor.y = v.y / mag;