aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs11
1 files changed, 5 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
index 308cf13..30f6c8c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -315,7 +315,6 @@ public sealed class BSLinksetCompound : BSLinkset
315 // Note that this works for rebuilding just the root after a linkset is taken apart. 315 // Note that this works for rebuilding just the root after a linkset is taken apart.
316 // Called at taint time!! 316 // Called at taint time!!
317 private bool UseBulletSimRootOffsetHack = false; // Attempt to have Bullet track the coords of root compound shape 317 private bool UseBulletSimRootOffsetHack = false; // Attempt to have Bullet track the coords of root compound shape
318 private bool disableCOM = true; // For basic linkset debugging, turn off the center-of-mass setting
319 private void RecomputeLinksetCompound() 318 private void RecomputeLinksetCompound()
320 { 319 {
321 try 320 try
@@ -331,9 +330,7 @@ public sealed class BSLinksetCompound : BSLinkset
331 // There is no reason to build all this physical stuff for a non-physical linkset. 330 // There is no reason to build all this physical stuff for a non-physical linkset.
332 if (!LinksetRoot.IsPhysicallyActive) 331 if (!LinksetRoot.IsPhysicallyActive)
333 { 332 {
334 // Clean up any old linkset shape and make sure the root shape is set to the root object.
335 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,notPhysical", LinksetRoot.LocalID); 333 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,notPhysical", LinksetRoot.LocalID);
336
337 return; // Note the 'finally' clause at the botton which will get executed. 334 return; // Note the 'finally' clause at the botton which will get executed.
338 } 335 }
339 336
@@ -347,9 +344,9 @@ public sealed class BSLinksetCompound : BSLinkset
347 344
348 OMV.Quaternion invRootOrientation = OMV.Quaternion.Normalize(OMV.Quaternion.Inverse(LinksetRoot.RawOrientation)); 345 OMV.Quaternion invRootOrientation = OMV.Quaternion.Normalize(OMV.Quaternion.Inverse(LinksetRoot.RawOrientation));
349 346
350 // 'centerDisplacement' is the value to subtract from children to give physical offset position 347 // 'centerDisplacementV' is the value to subtract from children to give physical offset position
351 OMV.Vector3 centerDisplacementV = (centerOfMassW - LinksetRoot.RawPosition) * invRootOrientation; 348 OMV.Vector3 centerDisplacementV = (centerOfMassW - LinksetRoot.RawPosition) * invRootOrientation;
352 if (UseBulletSimRootOffsetHack || disableCOM) 349 if (UseBulletSimRootOffsetHack || !BSParam.LinksetOffsetCenterOfMass)
353 { 350 {
354 centerDisplacementV = OMV.Vector3.Zero; 351 centerDisplacementV = OMV.Vector3.Zero;
355 LinksetRoot.ClearDisplacement(); 352 LinksetRoot.ClearDisplacement();
@@ -357,6 +354,8 @@ public sealed class BSLinksetCompound : BSLinkset
357 else 354 else
358 { 355 {
359 LinksetRoot.SetEffectiveCenterOfMassDisplacement(centerDisplacementV); 356 LinksetRoot.SetEffectiveCenterOfMassDisplacement(centerDisplacementV);
357 // The actual center-of-mass could have been set by the user.
358 centerDisplacementV = LinksetRoot.PositionDisplacement;
360 } 359 }
361 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,rootPos={1},com={2},comDisp={3}", 360 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,rootPos={1},com={2},comDisp={3}",
362 LinksetRoot.LocalID, LinksetRoot.RawPosition, centerOfMassW, centerDisplacementV); 361 LinksetRoot.LocalID, LinksetRoot.RawPosition, centerOfMassW, centerDisplacementV);
@@ -409,7 +408,7 @@ public sealed class BSLinksetCompound : BSLinkset
409 { 408 {
410 // Enable the physical position updator to return the position and rotation of the root shape. 409 // Enable the physical position updator to return the position and rotation of the root shape.
411 // This enables a feature in the C++ code to return the world coordinates of the first shape in the 410 // This enables a feature in the C++ code to return the world coordinates of the first shape in the
412 // compound shape. This eleviates the need to offset the returned physical position by the 411 // compound shape. This aleviates the need to offset the returned physical position by the
413 // center-of-mass offset. 412 // center-of-mass offset.
414 m_physicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE); 413 m_physicsScene.PE.AddToCollisionFlags(LinksetRoot.PhysBody, CollisionFlags.BS_RETURN_ROOT_COMPOUND_SHAPE);
415 } 414 }