aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-03-03 20:58:54 +0000
committerJustin Clark-Casey (justincc)2014-03-03 23:35:21 +0000
commit31de7b845f18182d47ee43125c3fe6488da841e6 (patch)
tree234582dadf62d58a7381fc608dd5a875debe9bd6 /OpenSim/Region/ScriptEngine
parentMaybe slightly reduce warp3d memory leakage by disposing of decoded bitmap in... (diff)
downloadopensim-SC_OLD-31de7b845f18182d47ee43125c3fe6488da841e6.zip
opensim-SC_OLD-31de7b845f18182d47ee43125c3fe6488da841e6.tar.gz
opensim-SC_OLD-31de7b845f18182d47ee43125c3fe6488da841e6.tar.bz2
opensim-SC_OLD-31de7b845f18182d47ee43125c3fe6488da841e6.tar.xz
When positioning agent with PRIM_ROTATION in llSetLinkPrimitiveParams(), set the global rotation rather than the local rotation
Functionally the same as the patch in http://opensimulator.org/mantis/view.php?id=7044, thanks Aleric. This commit also extends the regression test
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs14
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs36
2 files changed, 38 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 2e8b053..b333b55 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -8047,7 +8047,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8047 sp.OffsetPosition = rules.GetVector3Item(idx++); 8047 sp.OffsetPosition = rules.GetVector3Item(idx++);
8048 break; 8048 break;
8049 8049
8050 case (int)ScriptBaseClass.PRIM_ROTATION: 8050 case (int)ScriptBaseClass.PRIM_ROTATION:
8051 if (remain < 1)
8052 return null;
8053
8054 Quaternion inRot = rules.GetQuaternionItem(idx++);
8055
8056 SceneObjectPart parentPart = sp.ParentPart;
8057
8058 if (parentPart != null)
8059 sp.Rotation = m_host.GetWorldRotation() * inRot;
8060
8061 break;
8062
8051 case (int)ScriptBaseClass.PRIM_ROT_LOCAL: 8063 case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
8052 if (remain < 1) 8064 if (remain < 1)
8053 return null; 8065 return null;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
index 167fe78..86381c4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
@@ -86,6 +86,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
86 86
87 new SceneHelpers().SetupScene(); 87 new SceneHelpers().SetupScene();
88 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; 88 SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart;
89 part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f);
89 90
90 LSL_Api apiGrp1 = new LSL_Api(); 91 LSL_Api apiGrp1 = new LSL_Api();
91 apiGrp1.Initialize(m_engine, part, null, null); 92 apiGrp1.Initialize(m_engine, part, null, null);
@@ -99,17 +100,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
99 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero); 100 sp.HandleAgentRequestSit(sp.ControllingClient, sp.UUID, part.UUID, Vector3.Zero);
100 101
101 // Test position 102 // Test position
102 Vector3 newPos = new Vector3(1, 2, 3); 103 {
103 apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos)); 104 Vector3 newPos = new Vector3(1, 2, 3);
104 105 apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_POSITION, newPos));
105 Assert.That(sp.OffsetPosition, Is.EqualTo(newPos)); 106
106 107 Assert.That(sp.OffsetPosition, Is.EqualTo(newPos));
107 // Test rotation 108 }
108 Quaternion newRot = new Quaternion(0, 0.7071068f, 0, 0.7071068f); 109
109 apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_ROTATION, newRot)); 110 // Test world rotation
110 111 {
111 Assert.That( 112 Quaternion newRot = new Quaternion(0, 0.7071068f, 0, 0.7071068f);
112 sp.Rotation, new QuaternionToleranceConstraint(newRot, 0.000001)); 113 apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_ROTATION, newRot));
114
115 Assert.That(
116 sp.Rotation, new QuaternionToleranceConstraint(part.GetWorldRotation() * newRot, 0.000001));
117 }
118
119 // Test local rotation
120 {
121 Quaternion newRot = new Quaternion(0, 0.7071068f, 0, 0.7071068f);
122 apiGrp1.llSetLinkPrimitiveParams(2, new LSL_Types.list(ScriptBaseClass.PRIM_ROT_LOCAL, newRot));
123
124 Assert.That(
125 sp.Rotation, new QuaternionToleranceConstraint(newRot, 0.000001));
126 }
113 } 127 }
114 } 128 }
115} \ No newline at end of file 129} \ No newline at end of file