29 using System.Reflection;
30 using System.Threading;
31 using NUnit.Framework;
33 using OpenSim.Framework;
34 using OpenSim.Region.Framework.Scenes;
35 using OpenSim.Tests.Common;
37 namespace OpenSim.
Region.Framework.Scenes.Tests
46 UUID m_ownerId = TestHelpers.ParseTail(0x1);
59 TestHelpers.InMethod();
61 Vector3 position =
new Vector3(10, 20, 30);
64 = SceneHelpers.CreateSceneObject(1, m_ownerId,
"obj1", 0x10);
65 so.AbsolutePosition = position;
66 m_scene.AddNewSceneObject(so,
false);
68 Assert.That(so.AbsolutePosition, Is.EqualTo(position));
74 TestHelpers.InMethod();
76 Vector3 partPosition =
new Vector3(10, 20, 30);
79 = SceneHelpers.CreateSceneObject(1, m_ownerId,
"obj1", 0x10);
80 so.AbsolutePosition = partPosition;
81 m_scene.AddNewSceneObject(so,
false);
83 Assert.That(so.RootPart.AbsolutePosition, Is.EqualTo(partPosition));
84 Assert.That(so.RootPart.GroupPosition, Is.EqualTo(partPosition));
85 Assert.That(so.RootPart.GetWorldPosition(), Is.EqualTo(partPosition));
86 Assert.That(so.RootPart.RelativePosition, Is.EqualTo(partPosition));
87 Assert.That(so.RootPart.OffsetPosition, Is.EqualTo(Vector3.Zero));
93 TestHelpers.InMethod();
95 Vector3 rootPartPosition =
new Vector3(10, 20, 30);
96 Vector3 childOffsetPosition =
new Vector3(2, 3, 4);
99 = SceneHelpers.CreateSceneObject(2, m_ownerId,
"obj1", 0x10);
100 so.AbsolutePosition = rootPartPosition;
101 so.Parts[1].OffsetPosition = childOffsetPosition;
103 m_scene.AddNewSceneObject(so,
false);
106 Vector3 childPosition =
new Vector3(rootPartPosition + childOffsetPosition);
109 Assert.That(childPart.AbsolutePosition, Is.EqualTo(childPosition));
110 Assert.That(childPart.GroupPosition, Is.EqualTo(rootPartPosition));
111 Assert.That(childPart.GetWorldPosition(), Is.EqualTo(childPosition));
112 Assert.That(childPart.RelativePosition, Is.EqualTo(childOffsetPosition));
113 Assert.That(childPart.OffsetPosition, Is.EqualTo(childOffsetPosition));
119 TestHelpers.InMethod();
121 Vector3 rootPartPosition =
new Vector3(10, 20, 30);
122 Vector3 childOffsetPosition =
new Vector3(2, 3, 4);
125 = SceneHelpers.CreateSceneObject(2, m_ownerId,
"obj1", 0x10);
126 so.AbsolutePosition = rootPartPosition;
127 so.Parts[1].OffsetPosition = childOffsetPosition;
129 m_scene.AddNewSceneObject(so,
false);
131 so.UpdateGroupRotationR(Quaternion.CreateFromEulers(0, 0, -90 * Utils.DEG_TO_RAD));
134 Vector3 rotatedChildOffsetPosition
135 =
new Vector3(childOffsetPosition.Y, -childOffsetPosition.X, childOffsetPosition.Z);
137 Vector3 childPosition =
new Vector3(rootPartPosition + rotatedChildOffsetPosition);
141 Assert.That(childPart.AbsolutePosition, Is.EqualTo(childPosition));
143 Assert.That(childPart.GroupPosition, Is.EqualTo(rootPartPosition));
144 Assert.That(childPart.GetWorldPosition(), Is.EqualTo(childPosition));
147 Assert.That(childPart.RelativePosition, Is.EqualTo(childOffsetPosition));
150 Assert.That(childPart.OffsetPosition, Is.EqualTo(childOffsetPosition));
void TestGetChildPartPositionAfterObjectRotation()
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
void TestGetChildPartPosition()
Spatial scene object tests (will eventually cover root and child part position, rotation properties...
void TestGetRootPartPosition()
void TestGetSceneObjectGroupPosition()
Helpers for setting up scenes.