From 74dea4cfd52be75b4dd6277260c3ada80b939fbb Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 27 Sep 2012 19:57:35 -0700 Subject: BulletSim: rename some constraint variables to be consistant with other name use. Added callbacks for shape and body changes in GetBodyAndShape() so the linkset constraints can be picked up and restored. A better design might be to have a "prim shape changed" event. Think about that. Added constraint types to general constraint class. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 8688485..c879143 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1111,13 +1111,21 @@ public sealed class BSPrim : BSPhysObject // Undo me from any possible linkset so, if body is rebuilt, the link will get restored. // NOTE that the new linkset is not set. This saves the handle to the linkset // so we can add ourselves back when shape mangling is complete. - Linkset.RemoveMeFromLinkset(this); + bool needToRestoreLinkset = false; // Create the correct physical representation for this type of object. // Updates BSBody and BSShape with the new information. - PhysicsScene.Shapes.GetBodyAndShape(forceRebuild, PhysicsScene.World, this, shapeData, _pbs); + PhysicsScene.Shapes.GetBodyAndShape(forceRebuild, PhysicsScene.World, this, shapeData, _pbs, + null, delegate(BulletBody dBody) + { + // Called if the current prim body is about to be destroyed. + // The problem is the constraints for Linksets which need to be updated for the new body. + Linkset.RemoveBodyDependencies(this); + needToRestoreLinkset = true; + }); - Linkset = Linkset.AddMeToLinkset(this); + if (needToRestoreLinkset) + Linkset.RestoreBodyDependencies(this); // Make sure the properties are set on the new object UpdatePhysicalParameters(); -- cgit v1.1