diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f893eb38ec..01f4808213 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -530,10 +530,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.AttachedAvatar = sp.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; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f2b7014b35..a6ffe6e1c8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2023,8 +2023,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 e52131e805..822d54f7f0 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) { @@ -4399,12 +4400,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 { @@ -4518,6 +4516,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) ||