From 45e945616bfdab2ef57744670d3bb21acc1b3fcf Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 15 Jan 2008 04:14:27 +0000 Subject: * Pass 2 of collidable (non physical) linksets * Linkset status is now persistent * Tweaked a physics child prim positioning hack to generate less database saves * Re-factored physics object creation calls into ApplyPhysics. To create a new physics representation of an object or linkset, it's only necessary to call *group*.ApplyPhysics(bool m_physicalPrim). *lbsa has been waiting for this refactoring* * We have collidable linksets now. (they don't become phantom anymore) --- .../Region/Environment/Scenes/SceneObjectPart.cs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index f2594a9..468e2d0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -261,7 +261,7 @@ namespace OpenSim.Region.Environment.Scenes try { // Hack to get the child prim to update positions in the physics engine - ParentGroup.AbsolutePosition = ParentGroup.AbsolutePosition; + ParentGroup.ResetChildPrimPhysicsPositions(); } catch (System.NullReferenceException) { @@ -646,14 +646,17 @@ namespace OpenSim.Region.Environment.Scenes return newobject; } - public void ApplyPhysics() + public void ApplyPhysics(uint rootObjectFlags, bool m_physicalPrim) { - bool isPhysical = ((ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); - bool isPhantom = ((ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0); - bool usePhysics = isPhysical && !isPhantom; + bool isPhysical = (((rootObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0) && m_physicalPrim); + bool isPhantom = ((rootObjectFlags & (uint) LLObject.ObjectFlags.Phantom) != 0); - if (usePhysics) + // Added clarification.. since A rigid body is an object that you can kick around, etc. + bool RigidBody = isPhysical && !isPhantom; + + // The only time the physics scene shouldn't know about the prim is if it's phantom + if (!isPhantom) { PhysActor = m_parentGroup.Scene.PhysicsScene.AddPrimShape( Name, @@ -662,10 +665,11 @@ namespace OpenSim.Region.Environment.Scenes AbsolutePosition.Z), new PhysicsVector(Scale.X, Scale.Y, Scale.Z), new Quaternion(RotationOffset.W, RotationOffset.X, - RotationOffset.Y, RotationOffset.Z), usePhysics); - } + RotationOffset.Y, RotationOffset.Z), RigidBody); - DoPhysicsPropertyUpdate(usePhysics, true); + + DoPhysicsPropertyUpdate(RigidBody, true); + } } public void ApplyNextOwnerPermissions() -- cgit v1.1