diff options
author | Teravus Ovares (Dan Olivares) | 2009-09-08 04:43:17 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-09-08 04:43:17 -0400 |
commit | f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd (patch) | |
tree | bea9234644b05887b4c7cc063d457b91610ed9dc /OpenSim/Region/ScriptEngine/Shared | |
parent | * Fixes a 'take object from mega region' and rez it in a regular region.. ... (diff) | |
parent | llRot2Euler() now returns angles -PI < angle < PI (diff) | |
download | opensim-SC-f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd.zip opensim-SC-f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd.tar.gz opensim-SC-f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd.tar.bz2 opensim-SC-f0e2fd426b074ceb992124cf5eb2ebe8db5c04dd.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
3 files changed, 20 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 16dd834..f261c16 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -476,9 +476,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
476 | // normalize an angle between -PI and PI (-180 to +180 degrees) | 476 | // normalize an angle between -PI and PI (-180 to +180 degrees) |
477 | protected double NormalizeAngle(double angle) | 477 | protected double NormalizeAngle(double angle) |
478 | { | 478 | { |
479 | angle = angle % (Math.PI * 2); | 479 | if (angle > -Math.PI && angle < Math.PI) |
480 | // if (angle < 0) angle = angle + Math.PI * 2; | 480 | return angle; |
481 | return angle; | 481 | |
482 | int numPis = (int)(Math.PI / angle); | ||
483 | double remainder = angle - Math.PI * numPis; | ||
484 | if (numPis % 2 == 1) | ||
485 | return Math.PI - angle; | ||
486 | return remainder; | ||
482 | } | 487 | } |
483 | 488 | ||
484 | // Old implementation of llRot2Euler, now normalized | 489 | // Old implementation of llRot2Euler, now normalized |
@@ -497,9 +502,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
497 | NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))), | 502 | NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))), |
498 | NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)))); | 503 | NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)))); |
499 | else if (n > 0) | 504 | else if (n > 0) |
500 | return new LSL_Vector(0.0, Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); | 505 | return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); |
501 | else | 506 | else |
502 | return new LSL_Vector(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); | 507 | return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); |
503 | } | 508 | } |
504 | 509 | ||
505 | /* From wiki: | 510 | /* From wiki: |
@@ -553,12 +558,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
553 | 558 | ||
554 | double x,y,z,s; | 559 | double x,y,z,s; |
555 | 560 | ||
556 | double c1 = Math.Cos(v.x/2.0); | 561 | double c1 = Math.Cos(v.x * 0.5); |
557 | double c2 = Math.Cos(v.y/2.0); | 562 | double c2 = Math.Cos(v.y * 0.5); |
558 | double c3 = Math.Cos(v.z/2.0); | 563 | double c3 = Math.Cos(v.z * 0.5); |
559 | double s1 = Math.Sin(v.x/2.0); | 564 | double s1 = Math.Sin(v.x * 0.5); |
560 | double s2 = Math.Sin(v.y/2.0); | 565 | double s2 = Math.Sin(v.y * 0.5); |
561 | double s3 = Math.Sin(v.z/2.0); | 566 | double s3 = Math.Sin(v.z * 0.5); |
562 | 567 | ||
563 | x = s1*c2*c3+c1*s2*s3; | 568 | x = s1*c2*c3+c1*s2*s3; |
564 | y = c1*s2*c3-s1*c2*s3; | 569 | y = c1*s2*c3-s1*c2*s3; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs index 838cafb..917ca44 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/ScriptBase.cs | |||
@@ -112,7 +112,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
112 | if (!inits.ContainsKey(api)) | 112 | if (!inits.ContainsKey(api)) |
113 | return; | 113 | return; |
114 | 114 | ||
115 | ILease lease = (ILease)RemotingServices.GetLifetimeService(data as MarshalByRefObject); | 115 | //ILease lease = (ILease)RemotingServices.GetLifetimeService(data as MarshalByRefObject); |
116 | RemotingServices.GetLifetimeService(data as MarshalByRefObject); | ||
116 | // lease.Register(m_sponser); | 117 | // lease.Register(m_sponser); |
117 | 118 | ||
118 | MethodInfo mi = inits[api]; | 119 | MethodInfo mi = inits[api]; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 225126d..04f7862 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -260,7 +260,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
260 | Path.GetFileNameWithoutExtension(assembly), | 260 | Path.GetFileNameWithoutExtension(assembly), |
261 | "SecondLife.Script"); | 261 | "SecondLife.Script"); |
262 | 262 | ||
263 | ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); | 263 | //ILease lease = (ILease)RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); |
264 | RemotingServices.GetLifetimeService(m_Script as ScriptBaseClass); | ||
264 | // lease.Register(this); | 265 | // lease.Register(this); |
265 | } | 266 | } |
266 | catch (Exception) | 267 | catch (Exception) |