diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index b965d75443..3a3a1667cb 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -764,10 +764,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.AttachedAvatar = avatar.UUID; if (so.RootPart.PhysActor != null) - { - m_scene.PhysicsScene.RemovePrim(so.RootPart.PhysActor); - so.RootPart.PhysActor = null; - } + so.RootPart.RemoveFromPhysics(); so.AbsolutePosition = attachOffset; so.RootPart.AttachedPos = attachOffset; @@ -891,4 +888,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return item; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 15bf81cab3..9c97bb30a0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2022,8 +2022,7 @@ namespace OpenSim.Region.Framework.Scenes } else if (part.PhysActor != null) { - PhysicsScene.RemovePrim(part.PhysActor); - part.PhysActor = null; + part.RemoveFromPhysics(); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a770bd2f7f..f478de152f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1589,6 +1589,7 @@ namespace OpenSim.Region.Framework.Scenes m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom.", m_uuid); PhysActor = null; } + // Basic Physics returns null.. joy joy joy. if (PhysActor != null) { @@ -4403,12 +4404,9 @@ namespace OpenSim.Region.Framework.Scenes || (Shape.PathCurve == (byte)Extrusion.Flexible)) // note: this may have been changed above in the case of joints { AddFlag(PrimFlags.Phantom); + if (PhysActor != null) - { - m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); - /// that's not wholesome. Had to make Scene public - PhysActor = null; - } + RemoveFromPhysics(); } else // Not phantom { @@ -4522,6 +4520,20 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE OBJECT PART]: Updated PrimFlags on {0} {1} to {2}", Name, LocalId, Flags); } + /// + /// This removes the part from physics + /// + /// + /// This isn't the same as turning off physical, since even without being physical the prim has a physics + /// representation for collision detection. Rather, this would be used in situations such as making a prim + /// phantom. + /// + public void RemoveFromPhysics() + { + ParentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); + PhysActor = null; + } + public void UpdateRotation(Quaternion rot) { if ((rot.X != RotationOffset.X) ||