From 0a5c48b1c820d0899ffb130c9bf0a59b04bc9099 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 2 Mar 2008 09:31:39 +0000 Subject: * This is a very icky implementation of physical linkset prim using fixed joints. This will change quite drastically, however it's fun to play with. * To play with this you must link your prim before setting it physical, otherwise they won't link in the physics engine properly. This will also be fixed. * Currently the linked prim are extremely unstable because I have yet to implement combining of forces with the same normal. This will also be fixed. In fact, the whole PhysicsActor, ODEPrim relationship will be reworked to consider groups from the get-go. * This implementation is better then it crashing your sim, so I'm commiting it for now. --- OpenSim/Region/Environment/Scenes/Scene.cs | 4 ++-- OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 7 +++++-- OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 11 +++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index f6e3d82..a20e466 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -120,8 +120,8 @@ namespace OpenSim.Region.Environment.Scenes private int m_update_physics = 1; private int m_update_entitymovement = 1; - private int m_update_entities = 20; // Run through all objects checking for updates - private int m_update_entitiesquick = 1; // Run through objects that have scheduled updates checking for updates + private int m_update_entities = 1; // Run through all objects checking for updates + private int m_update_entitiesquick = 200; // Run through objects that have scheduled updates checking for updates private int m_update_presences = 1; // Update scene presence movements private int m_update_events = 1; private int m_update_backup = 200; diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 801e614..713c3ba 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs @@ -1758,10 +1758,13 @@ namespace OpenSim.Region.Environment.Scenes { lock (m_parts) { + m_rootPart.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); foreach (SceneObjectPart part in m_parts.Values) { - part.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); - + if (part.LocalID != m_rootPart.LocalID) + { + part.ApplyPhysics(m_rootPart.ObjectFlags, m_physicalPrim); + } // Hack to get the physics scene geometries in the right spot ResetChildPrimPhysicsPositions(); diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 6da4c3e..04fa03e 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1306,9 +1306,12 @@ namespace OpenSim.Region.Environment.Scenes PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; + PhysActor.delink(); } PhysActor.IsPhysical = UsePhysics; + + // If we're not what we're supposed to be in the physics scene, recreate ourselves. //m_parentGroup.Scene.PhysicsScene.RemovePrim(PhysActor); /// that's not wholesome. Had to make Scene public @@ -1331,6 +1334,14 @@ namespace OpenSim.Region.Environment.Scenes PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; PhysActor.OnOutOfBounds += PhysicsOutOfBounds; + if (ParentID != 0 && ParentID != LocalID) + { + if (ParentGroup.RootPart.PhysActor != null) + { + PhysActor.link(ParentGroup.RootPart.PhysActor); + } + } + } } } -- cgit v1.1