From ae9a98ceb15e43dc24c485955051f554a2247401 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 14 Mar 2008 06:20:50 +0000 Subject: * Added proper handling of llSetStatus(STATUS_PHYSICS,BOOL) --- .../Region/Environment/Scenes/SceneObjectGroup.cs | 47 ++++++++++++++++++++++ .../Region/Environment/Scenes/SceneObjectPart.cs | 15 ++++++- 2 files changed, 61 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 041dc4e..47c4567 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -590,6 +590,53 @@ namespace OpenSim.Region.Environment.Scenes SetPartAsRoot(newPart); } + public void ScriptSetPhysicsStatus(bool UsePhysics) + { + if (m_scene.m_physicalPrim) + { + lock (m_parts) + { + foreach (SceneObjectPart part in m_parts.Values) + { + if (UsePhysics) + part.AddFlag(LLObject.ObjectFlags.Physics); + else + part.RemFlag(LLObject.ObjectFlags.Physics); + + part.DoPhysicsPropertyUpdate(UsePhysics, false); + IsSelected = false; + } + } + } + + } + + public void ScriptSetPhantomStatus(bool PhantomStatus) + { + lock (m_parts) + { + foreach (SceneObjectPart part in m_parts.Values) + { + if (PhantomStatus) + { + part.AddFlag(LLObject.ObjectFlags.Phantom); + if (part.PhysActor != null) + { + m_scene.PhysicsScene.RemovePrim(part.PhysActor); + } + } + else + { + part.RemFlag(LLObject.ObjectFlags.Phantom); + if ((part.ObjectFlags & (int)LLObject.ObjectFlags.Physics) != 0) + { + part.DoPhysicsPropertyUpdate(true, false); + } + } + } + } + } + public void applyImpulse(PhysicsVector impulse) { // We check if rootpart is null here because scripts don't delete if you delete the host. diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index ffb9d36..5b3ea0f 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1326,7 +1326,20 @@ namespace OpenSim.Region.Environment.Scenes // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); ScheduleFullUpdate(); } - + public void ScriptSetPhysicsStatus(bool UsePhysics) + { + if (m_parentGroup != null) + { + m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); + } + } + public void ScriptSetPhantomStatus(bool Phantom) + { + if (m_parentGroup != null) + { + m_parentGroup.ScriptSetPhantomStatus(Phantom); + } + } public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) { if (PhysActor != null) -- cgit v1.1