aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorDr Scofield2008-10-07 11:41:43 +0000
committerDr Scofield2008-10-07 11:41:43 +0000
commite5a50b6a3b112bee131e6cfdfbfed5c203240bff (patch)
tree5c9b6e4b866c2377b981ca9d5fa09855eaedf31b /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentFrom: chris yeoh <yeohc@au1.ibm.com> (diff)
downloadopensim-SC-e5a50b6a3b112bee131e6cfdfbfed5c203240bff.zip
opensim-SC-e5a50b6a3b112bee131e6cfdfbfed5c203240bff.tar.gz
opensim-SC-e5a50b6a3b112bee131e6cfdfbfed5c203240bff.tar.bz2
opensim-SC-e5a50b6a3b112bee131e6cfdfbfed5c203240bff.tar.xz
From: chris yeoh <yeohc@au1.ibm.com>
The attached patch fixes mantis bug 2312 (llGetPos() returns incorrect values for child prims where the root prim is rotated). Regression tests still pass. Incidentally AbsolutePosition which was used before looks a little suspicious to me as its always going to return the wrong value if the root prim is rotated. GetWorldPosition does take the rotation into account, but AbsolutePosition is used in a lot of places. Though i don't understand why there is both GetWorldPosition as well as AbsolutePosition so I've left the latter alone. [i also cleaned up some indent problems, --- dr scofield]
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs29
1 files changed, 13 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ccc483c..def8fbe 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -91,9 +91,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
91 config.AddConfig("XEngine"); 91 config.AddConfig("XEngine");
92 92
93 m_ScriptDelayFactor = config.Configs["XEngine"]. 93 m_ScriptDelayFactor = config.Configs["XEngine"].
94 GetFloat("ScriptDelayFactor", 1.0f); 94 GetFloat("ScriptDelayFactor", 1.0f);
95 m_ScriptDistanceFactor = config.Configs["XEngine"]. 95 m_ScriptDistanceFactor = config.Configs["XEngine"].
96 GetFloat("ScriptDistanceLimitFactor", 1.0f); 96 GetFloat("ScriptDistanceLimitFactor", 1.0f);
97 97
98 AsyncCommands = new AsyncCommandManager(ScriptEngine); 98 AsyncCommands = new AsyncCommandManager(ScriptEngine);
99 } 99 }
@@ -937,7 +937,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
937 public LSL_Float llGround(LSL_Vector offset) 937 public LSL_Float llGround(LSL_Vector offset)
938 { 938 {
939 m_host.AddScriptLPS(1); 939 m_host.AddScriptLPS(1);
940 Vector3 pos = m_host.GetWorldPosition(); 940 Vector3 pos = m_host.GetWorldPosition();
941 int x = (int)(pos.X + offset.x); 941 int x = (int)(pos.X + offset.x);
942 int y = (int)(pos.Y + offset.y); 942 int y = (int)(pos.Y + offset.y);
943 return World.GetLandHeight(x, y); 943 return World.GetLandHeight(x, y);
@@ -1719,9 +1719,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1719 public LSL_Vector llGetPos() 1719 public LSL_Vector llGetPos()
1720 { 1720 {
1721 m_host.AddScriptLPS(1); 1721 m_host.AddScriptLPS(1);
1722 return new LSL_Vector(m_host.AbsolutePosition.X, 1722 Vector3 pos = m_host.GetWorldPosition();
1723 m_host.AbsolutePosition.Y, 1723 return new LSL_Vector(pos.X, pos.Y, pos.Z);
1724 m_host.AbsolutePosition.Z);
1725 } 1724 }
1726 1725
1727 public LSL_Vector llGetLocalPos() 1726 public LSL_Vector llGetLocalPos()
@@ -4845,21 +4844,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4845 4844
4846 Vector3 p0 = new Vector3(pos.X, pos.Y, 4845 Vector3 p0 = new Vector3(pos.X, pos.Y,
4847 (float)llGround( 4846 (float)llGround(
4848 new LSL_Vector(pos.X, pos.Y, pos.Z) 4847 new LSL_Vector(pos.X, pos.Y, pos.Z)
4849 )); 4848 ));
4850 Vector3 p1 = new Vector3(pos.X + 1, pos.Y, 4849 Vector3 p1 = new Vector3(pos.X + 1, pos.Y,
4851 (float)llGround( 4850 (float)llGround(
4852 new LSL_Vector(pos.X + 1, pos.Y, pos.Z) 4851 new LSL_Vector(pos.X + 1, pos.Y, pos.Z)
4853 )); 4852 ));
4854 Vector3 p2 = new Vector3(pos.X, pos.Y + 1, 4853 Vector3 p2 = new Vector3(pos.X, pos.Y + 1,
4855 (float)llGround( 4854 (float)llGround(
4856 new LSL_Vector(pos.X, pos.Y + 1, pos.Z) 4855 new LSL_Vector(pos.X, pos.Y + 1, pos.Z)
4857 )); 4856 ));
4858 4857
4859 Vector3 v0 = new Vector3( 4858 Vector3 v0 = new Vector3(p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z);
4860 p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z); 4859 Vector3 v1 = new Vector3(p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z);
4861 Vector3 v1 = new Vector3(
4862 p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z);
4863 4860
4864 v0.Normalize(); 4861 v0.Normalize();
4865 v1.Normalize(); 4862 v1.Normalize();