diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 1f66b56..4ce58c7 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -399,7 +399,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
399 | // Constraint linksets are rebuilt every time. | 399 | // Constraint linksets are rebuilt every time. |
400 | // Note that this works for rebuilding just the root after a linkset is taken apart. | 400 | // Note that this works for rebuilding just the root after a linkset is taken apart. |
401 | // Called at taint time!! | 401 | // Called at taint time!! |
402 | private bool disableCOM = false; // DEBUG DEBUG: disable until we get this debugged | 402 | private bool disableCOM = true; // DEBUG DEBUG: disable until we get this debugged |
403 | private void RecomputeLinksetCompound() | 403 | private void RecomputeLinksetCompound() |
404 | { | 404 | { |
405 | try | 405 | try |
@@ -430,10 +430,10 @@ public sealed class BSLinksetCompound : BSLinkset | |||
430 | LinksetRoot.ForcePosition = LinksetRoot.RawPosition; | 430 | LinksetRoot.ForcePosition = LinksetRoot.RawPosition; |
431 | 431 | ||
432 | // Update the local transform for the root child shape so it is offset from the <0,0,0> which is COM | 432 | // Update the local transform for the root child shape so it is offset from the <0,0,0> which is COM |
433 | PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, 0, | 433 | PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, 0 /* childIndex */, |
434 | -centerDisplacement, | 434 | -centerDisplacement, |
435 | LinksetRoot.RawOrientation, | 435 | OMV.Quaternion.Identity, // LinksetRoot.RawOrientation, |
436 | false /* shouldRecalculateLocalAabb */); | 436 | false /* shouldRecalculateLocalAabb (is done later after linkset built) */); |
437 | 437 | ||
438 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}", | 438 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}", |
439 | LinksetRoot.LocalID, centerOfMassW, LinksetRoot.RawPosition, centerDisplacement); | 439 | LinksetRoot.LocalID, centerOfMassW, LinksetRoot.RawPosition, centerDisplacement); |
@@ -463,7 +463,6 @@ public sealed class BSLinksetCompound : BSLinkset | |||
463 | // Use call to CreateGeomNonSpecial(). | 463 | // Use call to CreateGeomNonSpecial(). |
464 | BulletShape saveShape = cPrim.PhysShape; | 464 | BulletShape saveShape = cPrim.PhysShape; |
465 | cPrim.PhysShape.Clear(); // Don't let the create free the child's shape | 465 | cPrim.PhysShape.Clear(); // Don't let the create free the child's shape |
466 | // PhysicsScene.Shapes.CreateGeomNonSpecial(true, cPrim, null); | ||
467 | PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null); | 466 | PhysicsScene.Shapes.CreateGeomMeshOrHull(cPrim, null); |
468 | BulletShape newShape = cPrim.PhysShape; | 467 | BulletShape newShape = cPrim.PhysShape; |
469 | cPrim.PhysShape = saveShape; | 468 | cPrim.PhysShape = saveShape; |
@@ -471,6 +470,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
471 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement; | 470 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement; |
472 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; | 471 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; |
473 | PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, newShape, offsetPos, offsetRot); | 472 | PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, newShape, offsetPos, offsetRot); |
473 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addNative,indx={1},rShape={2},cShape={3},offPos={4},offRot={5}", | ||
474 | LinksetRoot.LocalID, memberIndex, LinksetRoot.PhysShape, newShape, offsetPos, offsetRot); | ||
474 | } | 475 | } |
475 | else | 476 | else |
476 | { | 477 | { |
@@ -484,7 +485,10 @@ public sealed class BSLinksetCompound : BSLinkset | |||
484 | } | 485 | } |
485 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement; | 486 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement; |
486 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; | 487 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; |
487 | PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot); | 488 | PhysicsScene.PE.AddChildShapeToCompoundShape(LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot); |
489 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addNonNative,indx={1},rShape={2},cShape={3},offPos={4},offRot={5}", | ||
490 | LinksetRoot.LocalID, memberIndex, LinksetRoot.PhysShape, cPrim.PhysShape, offsetPos, offsetRot); | ||
491 | |||
488 | } | 492 | } |
489 | memberIndex++; | 493 | memberIndex++; |
490 | } | 494 | } |
@@ -503,6 +507,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
503 | Rebuilding = false; | 507 | Rebuilding = false; |
504 | } | 508 | } |
505 | 509 | ||
510 | // See that the Aabb surrounds the new shape | ||
506 | PhysicsScene.PE.RecalculateCompoundShapeLocalAabb(LinksetRoot.PhysShape); | 511 | PhysicsScene.PE.RecalculateCompoundShapeLocalAabb(LinksetRoot.PhysShape); |
507 | } | 512 | } |
508 | } | 513 | } |