From 0d5311e49bf5700efcf779bfa4bc83a00585c424 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 23 Aug 2007 17:21:08 +0000 Subject: Added RemovePrim method to the physics plugins interface. Implemented that method in ODE plugin. Hooked it up so when deleting/taking prims into your inventory they will be removed from physics engine. Enabled the other physics hook ups in Scene.cs (and also added registering prims with physics plugin when they are rezzed from Inventory.) So now to get the avatar to prim collision testing working, just change to use the ODE plugin (in the OpenSim.ini file, physics = OpenDynamicsEngine). Remember though ODE only really works (without problems) when running with a single region. --- OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/Scene.Inventory.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 9cbd65b..83cd83c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -8,6 +8,7 @@ using OpenSim.Framework.Types; using OpenSim.Framework.Communications.Caches; using OpenSim.Framework.Data; using OpenSim.Framework.Utilities; +using OpenSim.Physics.Manager; namespace OpenSim.Region.Environment.Scenes { @@ -354,6 +355,12 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendInventoryItemUpdate(item); } + SceneObjectPart rootPart = ((SceneObjectGroup)selectedEnt).GetChildPart(((SceneObjectGroup)selectedEnt).UUID); + if (rootPart.PhysActor != null) + { + this.phyScene.RemovePrim(rootPart.PhysActor); + } + storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID); ((SceneObjectGroup)selectedEnt).DeleteGroup(); @@ -361,6 +368,7 @@ namespace OpenSim.Region.Environment.Scenes { Entities.Remove(((SceneObjectGroup)selectedEnt).UUID); } + ((SceneObjectGroup)selectedEnt).DeleteParts(); } } } @@ -405,6 +413,12 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectGroup group = new SceneObjectGroup(this, this.m_regionHandle, xmlData); this.AddEntity(group); group.AbsolutePosition = pos; + SceneObjectPart rootPart = group.GetChildPart(group.UUID); + rootPart.PhysActor = phyScene.AddPrim( + new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, rootPart.AbsolutePosition.Z), + new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), + new Axiom.Math.Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, + rootPart.RotationOffset.Y, rootPart.RotationOffset.Z)); } -- cgit v1.1