From fcc7f86427f14f9a43a918f30cdf97b438c49a77 Mon Sep 17 00:00:00 2001 From: MW Date: Fri, 13 Jul 2007 16:12:38 +0000 Subject: Changed simpleApp to use basic physics. Done some work of fixing primitive/SceneObject copying. Set DefaultHome region to 1000,1000. --- OpenSim/Region/Environment/Scenes/Primitive.cs | 16 ++++++++++++---- OpenSim/Region/Environment/Scenes/SceneObject.cs | 22 +++++++++++----------- 2 files changed, 23 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index 4bb43d2..53314e3 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -139,7 +139,7 @@ namespace OpenSim.Region.Environment.Scenes this.m_isRootPrim = isRoot; this.m_RootParent = rootObject; - this.CreateFromPacket(ownerID, localID, pos, shape); + this.CreateFromShape(ownerID, localID, pos, shape); this.Rotation = Axiom.Math.Quaternion.Identity; } @@ -164,14 +164,22 @@ namespace OpenSim.Region.Environment.Scenes dupe.m_Parent = parent; dupe.m_RootParent = rootParent; // TODO: Copy this properly. - dupe.m_Shape = this.m_Shape; - + dupe.m_Shape = this.m_Shape.Copy(); + dupe.children = new List(); uint newLocalID = this.m_world.PrimIDAllocate(); + dupe.uuid = LLUUID.Random(); dupe.LocalId = newLocalID; dupe.Scale = new LLVector3(this.Scale.X, this.Scale.Y, this.Scale.Z); dupe.Rotation = new Quaternion(this.Rotation.w, this.Rotation.x, this.Rotation.y, this.Rotation.z); dupe.Pos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); + rootParent.AddChildToList(dupe); + + foreach (Primitive prim in this.children) + { + Primitive primClone = prim.Copy(this, rootParent); + dupe.children.Add(primClone); + } return dupe; } @@ -210,7 +218,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void CreateFromPacket(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) + public void CreateFromShape(LLUUID ownerID, uint localID, LLVector3 pos, PrimitiveBaseShape shape) { this.CreationDate = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; this.OwnerID = ownerID; diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs index 5eed115..c586e9b 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObject.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Scenes private bool physicsEnabled = false; private PhysicsScene m_PhysScene; private PhysicsActor m_PhysActor; - + public LLUUID rootUUID { get @@ -73,7 +73,7 @@ namespace OpenSim.Region.Environment.Scenes m_regionHandle = regionHandle; m_world = world; this.Pos = pos; - this.CreateRootFromPacket(ownerID, localID, shape, pos ); + this.CreateRootFromShape(ownerID, localID, shape, pos); } /// @@ -91,11 +91,11 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void CreateRootFromPacket(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) + public void CreateRootFromShape(LLUUID agentID, uint localID, PrimitiveBaseShape shape, LLVector3 pos) { - this.rootPrimitive = new Primitive( this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos); - this.children.Add(rootPrimitive); - this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); + this.rootPrimitive = new Primitive(this.m_regionHandle, this.m_world, agentID, localID, true, this, this, shape, pos); + this.children.Add(rootPrimitive); + this.ChildPrimitives.Add(this.rootUUID, this.rootPrimitive); } /// @@ -207,7 +207,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) { - this.rootPrimitive.Pos = pos ; + this.rootPrimitive.Pos = pos; this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); } @@ -232,16 +232,16 @@ namespace OpenSim.Region.Environment.Scenes proper.ObjectData[0].OwnerID = this.rootPrimitive.OwnerID; proper.ObjectData[0].TouchName = enc.GetBytes(this.rootPrimitive.TouchName + "\0"); proper.ObjectData[0].TextureID = new byte[0]; - proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName +"\0") ; - proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name +"\0"); - proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description +"\0"); + proper.ObjectData[0].SitName = enc.GetBytes(this.rootPrimitive.SitName + "\0"); + proper.ObjectData[0].Name = enc.GetBytes(this.rootPrimitive.Name + "\0"); + proper.ObjectData[0].Description = enc.GetBytes(this.rootPrimitive.Description + "\0"); proper.ObjectData[0].OwnerMask = this.rootPrimitive.OwnerMask; proper.ObjectData[0].NextOwnerMask = this.rootPrimitive.NextOwnerMask; proper.ObjectData[0].GroupMask = this.rootPrimitive.GroupMask; proper.ObjectData[0].EveryoneMask = this.rootPrimitive.EveryoneMask; proper.ObjectData[0].BaseMask = this.rootPrimitive.BaseMask; - client.OutPacket(proper); + client.OutPacket(proper); } } } -- cgit v1.1