diff options
author | Justin Clark-Casey (justincc) | 2011-04-13 22:29:12 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-04-13 22:29:12 +0100 |
commit | c81f5bfc5c3cb0bac2a89ee846099dcaae1f357b (patch) | |
tree | 2fa964daa58ca2f643f9a2f422e5fe70d6341851 | |
parent | refactor: move code to obtain the coalescence size and object offsets into Co... (diff) | |
download | opensim-SC_OLD-c81f5bfc5c3cb0bac2a89ee846099dcaae1f357b.zip opensim-SC_OLD-c81f5bfc5c3cb0bac2a89ee846099dcaae1f357b.tar.gz opensim-SC_OLD-c81f5bfc5c3cb0bac2a89ee846099dcaae1f357b.tar.bz2 opensim-SC_OLD-c81f5bfc5c3cb0bac2a89ee846099dcaae1f357b.tar.xz |
Adjust the quanterions used in the rez coalsced object tests to get sensible bounding box and offset numbers.
Extend test to check position of objects in the rezzed coalescence.
3 files changed, 24 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index c197cb9..c76a30a 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs | |||
@@ -93,12 +93,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
93 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | 93 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
94 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | 94 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); |
95 | Vector3 groupPosition = new Vector3(10, 20, 30); | 95 | Vector3 groupPosition = new Vector3(10, 20, 30); |
96 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | 96 | Quaternion rotationOffset = Quaternion.Identity; |
97 | Vector3 offsetPosition = new Vector3(5, 10, 15); | 97 | Vector3 offsetPosition = new Vector3(5, 10, 15); |
98 | 98 | ||
99 | SceneObjectPart part1 | 99 | SceneObjectPart part1 |
100 | = new SceneObjectPart( | 100 | = new SceneObjectPart( |
101 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | 101 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); |
102 | part1.Scale = new Vector3(1, 1, 1); | ||
102 | part1.Name = partName; | 103 | part1.Name = partName; |
103 | 104 | ||
104 | object1 = new SceneObjectGroup(part1); | 105 | object1 = new SceneObjectGroup(part1); |
@@ -109,13 +110,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
109 | string partName = "Object2"; | 110 | string partName = "Object2"; |
110 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); | 111 | UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); |
111 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); | 112 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); |
112 | Vector3 groupPosition = new Vector3(10, 20, 30); | 113 | Vector3 groupPosition = new Vector3(20, 40, 60); |
113 | Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); | 114 | Quaternion rotationOffset = Quaternion.Identity; |
114 | Vector3 offsetPosition = new Vector3(5, 10, 15); | 115 | Vector3 offsetPosition = new Vector3(5, 10, 15); |
115 | 116 | ||
116 | SceneObjectPart part1 | 117 | SceneObjectPart part1 |
117 | = new SceneObjectPart( | 118 | = new SceneObjectPart( |
118 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); | 119 | ownerId, shape, groupPosition, rotationOffset, offsetPosition); |
120 | part1.Scale = new Vector3(1, 1, 1); | ||
119 | part1.Name = partName; | 121 | part1.Name = partName; |
120 | 122 | ||
121 | object2 = new SceneObjectGroup(part1); | 123 | object2 = new SceneObjectGroup(part1); |
@@ -141,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
141 | 143 | ||
142 | SceneObjectGroup so | 144 | SceneObjectGroup so |
143 | = m_iam.RezObject( | 145 | = m_iam.RezObject( |
144 | m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false); | 146 | m_tc, item1Id, new Vector3(100, 100, 100), Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false); |
145 | 147 | ||
146 | Assert.That(so, Is.Not.Null); | 148 | Assert.That(so, Is.Not.Null); |
147 | 149 | ||
@@ -154,8 +156,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests | |||
154 | Assert.That(retrievedObj1Part, Is.Not.Null); | 156 | Assert.That(retrievedObj1Part, Is.Not.Null); |
155 | Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name)); | 157 | Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name)); |
156 | 158 | ||
159 | // Bottom of coalescence is placed on ground, hence we end up with 100.5 rather than 85 since the bottom | ||
160 | // object is unit square. | ||
161 | Assert.That(retrievedObj1Part.AbsolutePosition, Is.EqualTo(new Vector3(95, 90, 100.5f))); | ||
162 | |||
157 | SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name); | 163 | SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name); |
158 | Assert.That(retrievedObj2Part, Is.Not.Null); | 164 | Assert.That(retrievedObj2Part, Is.Not.Null); |
165 | Assert.That(retrievedObj2Part.Name, Is.EqualTo(object2.Name)); | ||
166 | Assert.That(retrievedObj2Part.AbsolutePosition, Is.EqualTo(new Vector3(105, 110, 130.5f))); | ||
159 | } | 167 | } |
160 | 168 | ||
161 | [Test] | 169 | [Test] |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e6dd489..fdd5205 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4870,6 +4870,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
4870 | Vector3 vec = g.AbsolutePosition; | 4870 | Vector3 vec = g.AbsolutePosition; |
4871 | 4871 | ||
4872 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); | 4872 | g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); |
4873 | |||
4874 | // m_log.DebugFormat( | ||
4875 | // "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}", | ||
4876 | // g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ)); | ||
4873 | 4877 | ||
4874 | ominX += vec.X; | 4878 | ominX += vec.X; |
4875 | omaxX += vec.X; | 4879 | omaxX += vec.X; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4d5eedf..ce1e6b8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2088,7 +2088,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2088 | 2088 | ||
2089 | axPos *= parentRot; | 2089 | axPos *= parentRot; |
2090 | Vector3 translationOffsetPosition = axPos; | 2090 | Vector3 translationOffsetPosition = axPos; |
2091 | return GroupPosition + translationOffsetPosition; | 2091 | |
2092 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name); | ||
2093 | |||
2094 | Vector3 worldPos = GroupPosition + translationOffsetPosition; | ||
2095 | |||
2096 | // m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name); | ||
2097 | |||
2098 | return worldPos; | ||
2092 | } | 2099 | } |
2093 | 2100 | ||
2094 | /// <summary> | 2101 | /// <summary> |