From a19896cc569c037436ad8e65f044224f169d63d4 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 9 Dec 2012 22:32:13 -0800 Subject: BulletSim: some comments about rebuilding linksets (having to recompute and restore a child's position in the world based on its position in the moved linkset). --- OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 1f7c398..bc9f9be 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs @@ -192,6 +192,8 @@ public sealed class BSLinksetCompound : BSLinkset child.LocalID, child.PhysBody.ptr.ToString("X")); // Cause the child's body to be rebuilt and thus restored to normal operation + // TODO: position and rotation must be restored because the child could have moved + // based on the linkset. child.ForceBodyShapeRebuild(false); if (!HasAnyChildren) @@ -236,9 +238,10 @@ public sealed class BSLinksetCompound : BSLinkset if (cPrim.PhysShape.isNativeShape) { - // Native shapes are not shared so we need to create a new one. - // A mesh or hull is created because scale is not available on a native shape. - // (TODO: Bullet does have a btScaledCollisionShape. Can that be used?) + // A native shape is turning into a null collision shape because native + // shapes are not shared so we have to hullify it so it will be tracked + // and freed at the correct time. This also solves the scaling problem + // (native shapes scaled but hull/meshes are assumed to not be). BulletShape saveShape = cPrim.PhysShape; cPrim.PhysShape.ptr = IntPtr.Zero; // Don't let the create free the child's shape PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null); -- cgit v1.1