From c93c9ea072f319125f466c913f5f4fe1f6864045 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 15 Oct 2011 02:02:39 +0100 Subject: factor common code out into SOP.RemoveFromPhysics() --- .../Avatar/Attachments/AttachmentsModule.cs | 5 +---- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +-- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f893eb3..01f4808 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 f2b7014..a6ffe6e 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 e52131e..822d54f 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) || -- cgit v1.1