diff options
author | Teravus Ovares | 2008-03-14 06:20:50 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-03-14 06:20:50 +0000 |
commit | ae9a98ceb15e43dc24c485955051f554a2247401 (patch) | |
tree | 27cd062a1ffd841eefba779db9752aa02350a8d1 /OpenSim | |
parent | * Preliminary work with the ODEPlugin to collect collision data. (diff) | |
download | opensim-SC-ae9a98ceb15e43dc24c485955051f554a2247401.zip opensim-SC-ae9a98ceb15e43dc24c485955051f554a2247401.tar.gz opensim-SC-ae9a98ceb15e43dc24c485955051f554a2247401.tar.bz2 opensim-SC-ae9a98ceb15e43dc24c485955051f554a2247401.tar.xz |
* Added proper handling of llSetStatus(STATUS_PHYSICS,BOOL)
Diffstat (limited to '')
3 files changed, 70 insertions, 3 deletions
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 | |||
590 | SetPartAsRoot(newPart); | 590 | SetPartAsRoot(newPart); |
591 | } | 591 | } |
592 | 592 | ||
593 | public void ScriptSetPhysicsStatus(bool UsePhysics) | ||
594 | { | ||
595 | if (m_scene.m_physicalPrim) | ||
596 | { | ||
597 | lock (m_parts) | ||
598 | { | ||
599 | foreach (SceneObjectPart part in m_parts.Values) | ||
600 | { | ||
601 | if (UsePhysics) | ||
602 | part.AddFlag(LLObject.ObjectFlags.Physics); | ||
603 | else | ||
604 | part.RemFlag(LLObject.ObjectFlags.Physics); | ||
605 | |||
606 | part.DoPhysicsPropertyUpdate(UsePhysics, false); | ||
607 | IsSelected = false; | ||
608 | } | ||
609 | } | ||
610 | } | ||
611 | |||
612 | } | ||
613 | |||
614 | public void ScriptSetPhantomStatus(bool PhantomStatus) | ||
615 | { | ||
616 | lock (m_parts) | ||
617 | { | ||
618 | foreach (SceneObjectPart part in m_parts.Values) | ||
619 | { | ||
620 | if (PhantomStatus) | ||
621 | { | ||
622 | part.AddFlag(LLObject.ObjectFlags.Phantom); | ||
623 | if (part.PhysActor != null) | ||
624 | { | ||
625 | m_scene.PhysicsScene.RemovePrim(part.PhysActor); | ||
626 | } | ||
627 | } | ||
628 | else | ||
629 | { | ||
630 | part.RemFlag(LLObject.ObjectFlags.Phantom); | ||
631 | if ((part.ObjectFlags & (int)LLObject.ObjectFlags.Physics) != 0) | ||
632 | { | ||
633 | part.DoPhysicsPropertyUpdate(true, false); | ||
634 | } | ||
635 | } | ||
636 | } | ||
637 | } | ||
638 | } | ||
639 | |||
593 | public void applyImpulse(PhysicsVector impulse) | 640 | public void applyImpulse(PhysicsVector impulse) |
594 | { | 641 | { |
595 | // We check if rootpart is null here because scripts don't delete if you delete the host. | 642 | // 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 | |||
1326 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); | 1326 | // System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); |
1327 | ScheduleFullUpdate(); | 1327 | ScheduleFullUpdate(); |
1328 | } | 1328 | } |
1329 | 1329 | public void ScriptSetPhysicsStatus(bool UsePhysics) | |
1330 | { | ||
1331 | if (m_parentGroup != null) | ||
1332 | { | ||
1333 | m_parentGroup.ScriptSetPhysicsStatus(UsePhysics); | ||
1334 | } | ||
1335 | } | ||
1336 | public void ScriptSetPhantomStatus(bool Phantom) | ||
1337 | { | ||
1338 | if (m_parentGroup != null) | ||
1339 | { | ||
1340 | m_parentGroup.ScriptSetPhantomStatus(Phantom); | ||
1341 | } | ||
1342 | } | ||
1330 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) | 1343 | public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) |
1331 | { | 1344 | { |
1332 | if (PhysActor != null) | 1345 | if (PhysActor != null) |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index e64fb36..ab7519e 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -609,11 +609,18 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
609 | m_host.AddScriptLPS(1); | 609 | m_host.AddScriptLPS(1); |
610 | if ((status & BuiltIn_Commands_BaseClass.STATUS_PHYSICS) == BuiltIn_Commands_BaseClass.STATUS_PHYSICS) | 610 | if ((status & BuiltIn_Commands_BaseClass.STATUS_PHYSICS) == BuiltIn_Commands_BaseClass.STATUS_PHYSICS) |
611 | { | 611 | { |
612 | m_host.AddFlag(LLObject.ObjectFlags.Physics); | 612 | if (value == 1) |
613 | m_host.ScriptSetPhysicsStatus(true); | ||
614 | else | ||
615 | m_host.ScriptSetPhysicsStatus(false); | ||
616 | |||
613 | } | 617 | } |
614 | if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM) | 618 | if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM) |
615 | { | 619 | { |
616 | m_host.AddFlag(LLObject.ObjectFlags.Phantom); | 620 | if (value == 1) |
621 | m_host.ScriptSetPhantomStatus(true); | ||
622 | else | ||
623 | m_host.ScriptSetPhantomStatus(false); | ||
617 | } | 624 | } |
618 | if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) | 625 | if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) |
619 | { | 626 | { |