aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs7
2 files changed, 7 insertions, 14 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7009548..4645e7a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -330,14 +330,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
330 return key; 330 return key;
331 } 331 }
332 332
333 // convert a LSL_Rotation to a Quaternion
334 public static Quaternion Rot2Quaternion(LSL_Rotation r)
335 {
336 Quaternion q = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
337 q.Normalize();
338 return q;
339 }
340
341 //These are the implementations of the various ll-functions used by the LSL scripts. 333 //These are the implementations of the various ll-functions used by the LSL scripts.
342 public LSL_Float llSin(double f) 334 public LSL_Float llSin(double f)
343 { 335 {
@@ -6532,12 +6524,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6532 6524
6533 protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot) 6525 protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot)
6534 { 6526 {
6535 // LSL quaternions can normalize to 0, normal Quaternions can't.
6536 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
6537 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
6538
6539 part.SitTargetPosition = offset; 6527 part.SitTargetPosition = offset;
6540 part.SitTargetOrientation = Rot2Quaternion(rot); 6528 part.SitTargetOrientation = rot;
6541 part.ParentGroup.HasGroupChanged = true; 6529 part.ParentGroup.HasGroupChanged = true;
6542 } 6530 }
6543 6531
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index bdc7d70..9d9df9c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -417,7 +417,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
417 417
418 public static implicit operator OMV_Quaternion(Quaternion rot) 418 public static implicit operator OMV_Quaternion(Quaternion rot)
419 { 419 {
420 return new OMV_Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); 420 // LSL quaternions can normalize to 0, normal Quaternions can't.
421 if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
422 rot.z = 1; // ZERO_ROTATION = 0,0,0,1
423 OMV_Quaternion omvrot = new OMV_Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
424 omvrot.Normalize();
425 return omvrot;
421 } 426 }
422 427
423 public static implicit operator Quaternion(OMV_Quaternion rot) 428 public static implicit operator Quaternion(OMV_Quaternion rot)