From 46ccfa1741abbf445b49e79045e649798d1c0b63 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 18 Nov 2007 13:37:02 +0000 Subject: * Found several cases where prim set physical were not subscribing to physics events. --- OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 4 ++++ OpenSim/Region/Environment/Scenes/Scene.cs | 6 ++++++ OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 7 +++++++ OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 2 ++ OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs | 7 +++++++ 5 files changed, 26 insertions(+) diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index c811966..b06fa2f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -449,7 +449,11 @@ namespace OpenSim.Region.Environment.Scenes new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); + + rootPart.doPhysicsPropertyUpdate(UsePhysics); + } + rootPart.ScheduleFullUpdate(); } } } \ No newline at end of file diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 0470335..0b9d218 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -647,6 +647,8 @@ namespace OpenSim.Region.Environment.Scenes // if not phantom, add to physics bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) + { + rootPart.PhysActor = phyScene.AddPrimShape( rootPart.Name, @@ -654,6 +656,10 @@ namespace OpenSim.Region.Environment.Scenes new PhysicsVector(pos.X, pos.Y, pos.Z), new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), new Quaternion(), UsePhysics); + // subscribe to physics events. + rootPart.doPhysicsPropertyUpdate(UsePhysics); + + } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 38e1609..628bd72 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -480,6 +480,8 @@ namespace OpenSim.Region.Environment.Scenes new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z), dupe.RootPart.PhysActor.IsPhysical); + dupe.RootPart.doPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical); + } // Now we've made a copy that replaces this one, we need to // switch the owner to the person who did the copying @@ -859,6 +861,8 @@ namespace OpenSim.Region.Environment.Scenes new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, linkPart.RotationOffset.Y, linkPart.RotationOffset.Z), m_rootPart.PhysActor.IsPhysical); + m_rootPart.doPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical); + } SceneObjectGroup objectGroup = new SceneObjectGroup(m_scene, m_regionHandle, linkPart); @@ -1165,6 +1169,9 @@ namespace OpenSim.Region.Environment.Scenes new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z), m_rootPart.PhysActor.IsPhysical); + bool UsePhysics = ((m_rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); + m_rootPart.doPhysicsPropertyUpdate(UsePhysics); + } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 0da90d5..18fe785 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -892,10 +892,12 @@ namespace OpenSim.Region.Environment.Scenes new PhysicsVector(Scale.X, Scale.Y, Scale.Z), new Quaternion(RotationOffset.W, RotationOffset.X, RotationOffset.Y, RotationOffset.Z), UsePhysics); + doPhysicsPropertyUpdate(UsePhysics); } else { PhysActor.IsPhysical = UsePhysics; + doPhysicsPropertyUpdate(UsePhysics); } } diff --git a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs index c2bb019..3b5fc57 100644 --- a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs @@ -46,6 +46,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_parentScene.m_physicalPrim); if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) + { rootPart.PhysActor = m_innerScene.PhyScene.AddPrimShape( rootPart.Name, rootPart.Shape, @@ -54,6 +55,9 @@ namespace OpenSim.Region.Environment.Scenes new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); + rootPart.doPhysicsPropertyUpdate(UsePhysics); + + } primCount++; } } @@ -112,6 +116,7 @@ namespace OpenSim.Region.Environment.Scenes SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_parentScene.m_physicalPrim); if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) + { rootPart.PhysActor = m_innerScene.PhyScene.AddPrimShape( rootPart.Name, rootPart.Shape, @@ -120,6 +125,8 @@ namespace OpenSim.Region.Environment.Scenes new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); + rootPart.doPhysicsPropertyUpdate(UsePhysics); + } } public void SavePrimsToXml2(string fileName) -- cgit v1.1