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.
bulletsim
Justin Clark-Casey (justincc) 2011-04-13 22:29:12 +01:00
parent 68cc5b46fe
commit c81f5bfc5c
3 changed files with 24 additions and 5 deletions

View File

@ -93,12 +93,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30); Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); Quaternion rotationOffset = Quaternion.Identity;
Vector3 offsetPosition = new Vector3(5, 10, 15); Vector3 offsetPosition = new Vector3(5, 10, 15);
SceneObjectPart part1 SceneObjectPart part1
= new SceneObjectPart( = new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition); ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Scale = new Vector3(1, 1, 1);
part1.Name = partName; part1.Name = partName;
object1 = new SceneObjectGroup(part1); object1 = new SceneObjectGroup(part1);
@ -109,13 +110,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
string partName = "Object2"; string partName = "Object2";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30); Vector3 groupPosition = new Vector3(20, 40, 60);
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); Quaternion rotationOffset = Quaternion.Identity;
Vector3 offsetPosition = new Vector3(5, 10, 15); Vector3 offsetPosition = new Vector3(5, 10, 15);
SceneObjectPart part1 SceneObjectPart part1
= new SceneObjectPart( = new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition); ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Scale = new Vector3(1, 1, 1);
part1.Name = partName; part1.Name = partName;
object2 = new SceneObjectGroup(part1); object2 = new SceneObjectGroup(part1);
@ -141,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
SceneObjectGroup so SceneObjectGroup so
= m_iam.RezObject( = m_iam.RezObject(
m_tc, item1Id, Vector3.Zero, Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false); m_tc, item1Id, new Vector3(100, 100, 100), Vector3.Zero, UUID.Zero, 1, false, false, false, UUID.Zero, false);
Assert.That(so, Is.Not.Null); Assert.That(so, Is.Not.Null);
@ -154,8 +156,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
Assert.That(retrievedObj1Part, Is.Not.Null); Assert.That(retrievedObj1Part, Is.Not.Null);
Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name)); Assert.That(retrievedObj1Part.Name, Is.EqualTo(item1.Name));
// Bottom of coalescence is placed on ground, hence we end up with 100.5 rather than 85 since the bottom
// object is unit square.
Assert.That(retrievedObj1Part.AbsolutePosition, Is.EqualTo(new Vector3(95, 90, 100.5f)));
SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name); SceneObjectPart retrievedObj2Part = m_scene.GetSceneObjectPart(object2.Name);
Assert.That(retrievedObj2Part, Is.Not.Null); Assert.That(retrievedObj2Part, Is.Not.Null);
Assert.That(retrievedObj2Part.Name, Is.EqualTo(object2.Name));
Assert.That(retrievedObj2Part.AbsolutePosition, Is.EqualTo(new Vector3(105, 110, 130.5f)));
} }
[Test] [Test]

View File

@ -4871,6 +4871,10 @@ namespace OpenSim.Region.Framework.Scenes
g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ); g.GetAxisAlignedBoundingBoxRaw(out ominX, out omaxX, out ominY, out omaxY, out ominZ, out omaxZ);
// m_log.DebugFormat(
// "[SCENE]: For {0} found AxisAlignedBoundingBoxRaw {1}, {2}",
// g.Name, new Vector3(ominX, ominY, ominZ), new Vector3(omaxX, omaxY, omaxZ));
ominX += vec.X; ominX += vec.X;
omaxX += vec.X; omaxX += vec.X;
ominY += vec.Y; ominY += vec.Y;

View File

@ -2088,7 +2088,14 @@ namespace OpenSim.Region.Framework.Scenes
axPos *= parentRot; axPos *= parentRot;
Vector3 translationOffsetPosition = axPos; Vector3 translationOffsetPosition = axPos;
return GroupPosition + translationOffsetPosition;
// m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name);
Vector3 worldPos = GroupPosition + translationOffsetPosition;
// m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name);
return worldPos;
} }
/// <summary> /// <summary>