diff options
author | Justin Clark-Casey (justincc) | 2014-03-03 20:58:54 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-03-03 23:35:21 +0000 |
commit | 31de7b845f18182d47ee43125c3fe6488da841e6 (patch) | |
tree | 234582dadf62d58a7381fc608dd5a875debe9bd6 /OpenSim/Region/ScriptEngine/Shared/Tests | |
parent | Maybe slightly reduce warp3d memory leakage by disposing of decoded bitmap in... (diff) | |
download | opensim-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/Shared/Tests')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs | 36 |
1 files changed, 25 insertions, 11 deletions
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 |