simplify coalesced object tests by using existing scene object set up utils

this change makes it possible to set an absolute position on a group before it is put into a scene.
bulletsim
Justin Clark-Casey (justincc) 2011-04-14 17:33:55 +01:00
parent c5465414b6
commit aaf9125869
2 changed files with 20 additions and 41 deletions

View File

@ -87,41 +87,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
// log4net.Config.XmlConfigurator.Configure();
// Create asset
SceneObjectGroup object1;
{
string partName = "Object1";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = Quaternion.Identity;
Vector3 offsetPosition = new Vector3(5, 10, 15);
SceneObjectPart part1
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Scale = new Vector3(1, 1, 1);
part1.Name = partName;
object1 = new SceneObjectGroup(part1);
}
SceneObjectGroup object1 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object1", 0x20);
object1.AbsolutePosition = new Vector3(15, 30, 45);
object1.Parts[0].Scale = new Vector3(1, 1, 1);
SceneObjectGroup object2;
{
string partName = "Object2";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(20, 40, 60);
Quaternion rotationOffset = Quaternion.Identity;
Vector3 offsetPosition = new Vector3(5, 10, 15);
SceneObjectPart part1
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Scale = new Vector3(1, 1, 1);
part1.Name = partName;
object2 = new SceneObjectGroup(part1);
}
SceneObjectGroup object2 = SceneSetupHelpers.CreateSceneObject(1, m_userId, "Object2", 0x40);
object2.AbsolutePosition = new Vector3(25, 50, 75);
object2.Parts[0].Scale = new Vector3(1, 1, 1);
CoalescedSceneObjects coa = new CoalescedSceneObjects(m_userId, object1, object2);

View File

@ -296,11 +296,14 @@ namespace OpenSim.Region.Framework.Scenes
{
Vector3 val = value;
if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|| m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
&& !IsAttachmentCheckFull() && (!m_scene.LoadingPrims))
if (Scene != null)
{
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
if ((Scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || Scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W)
|| Scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || Scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S))
&& !IsAttachmentCheckFull() && (!Scene.LoadingPrims))
{
m_scene.CrossPrimGroupIntoNewRegion(val, this, true);
}
}
if (RootPart.GetStatusSandbox())
@ -308,8 +311,11 @@ namespace OpenSim.Region.Framework.Scenes
if (Util.GetDistanceTo(RootPart.StatusSandboxPos, value) > 10)
{
RootPart.ScriptSetPhysicsStatus(false);
Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
if (Scene != null)
Scene.SimChat(Utils.StringToBytes("Hit Sandbox Limit"),
ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false);
return;
}
}
@ -326,7 +332,8 @@ namespace OpenSim.Region.Framework.Scenes
//m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
//}
m_scene.EventManager.TriggerParcelPrimCountTainted();
if (Scene != null)
Scene.EventManager.TriggerParcelPrimCountTainted();
}
}