diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 1f16cc8..350a5d1 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -347,21 +347,21 @@ public sealed class BSLinksetCompound : BSLinkset | |||
347 | // Bullet presumes an object's origin (relative <0,0,0>) is its center-of-mass | 347 | // Bullet presumes an object's origin (relative <0,0,0>) is its center-of-mass |
348 | OMV.Vector3 centerOfMassW = ComputeLinksetCenterOfMass(); | 348 | OMV.Vector3 centerOfMassW = ComputeLinksetCenterOfMass(); |
349 | 349 | ||
350 | OMV.Quaternion invRootOrientation = OMV.Quaternion.Inverse(LinksetRoot.RawOrientation); | 350 | OMV.Quaternion invRootOrientation = OMV.Quaternion.Normalize(OMV.Quaternion.Inverse(LinksetRoot.RawOrientation)); |
351 | 351 | ||
352 | // 'centerDisplacement' is the value to subtract from children to give physical offset position | 352 | // 'centerDisplacement' is the value to subtract from children to give physical offset position |
353 | OMV.Vector3 centerDisplacement = (centerOfMassW - LinksetRoot.RawPosition) * invRootOrientation; | 353 | OMV.Vector3 centerDisplacementV = (centerOfMassW - LinksetRoot.RawPosition) * invRootOrientation; |
354 | if (UseBulletSimRootOffsetHack || disableCOM) | 354 | if (UseBulletSimRootOffsetHack || disableCOM) |
355 | { | 355 | { |
356 | centerDisplacement = OMV.Vector3.Zero; | 356 | centerDisplacementV = OMV.Vector3.Zero; |
357 | LinksetRoot.ClearDisplacement(); | 357 | LinksetRoot.ClearDisplacement(); |
358 | } | 358 | } |
359 | else | 359 | else |
360 | { | 360 | { |
361 | LinksetRoot.SetEffectiveCenterOfMassDisplacement(centerDisplacement); | 361 | LinksetRoot.SetEffectiveCenterOfMassDisplacement(centerDisplacementV); |
362 | } | 362 | } |
363 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,rootPos={1},com={2},comDisp={3}", | 363 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,rootPos={1},com={2},comDisp={3}", |
364 | LinksetRoot.LocalID, LinksetRoot.RawPosition, centerOfMassW, centerDisplacement); | 364 | LinksetRoot.LocalID, LinksetRoot.RawPosition, centerOfMassW, centerDisplacementV); |
365 | 365 | ||
366 | // Add the shapes of all the components of the linkset | 366 | // Add the shapes of all the components of the linkset |
367 | int memberIndex = 1; | 367 | int memberIndex = 1; |
@@ -372,8 +372,8 @@ public sealed class BSLinksetCompound : BSLinkset | |||
372 | 372 | ||
373 | // Get a reference to the shape of the child and add that shape to the linkset compound shape | 373 | // Get a reference to the shape of the child and add that shape to the linkset compound shape |
374 | BSShape childShape = cPrim.PhysShape.GetReference(m_physicsScene, cPrim); | 374 | BSShape childShape = cPrim.PhysShape.GetReference(m_physicsScene, cPrim); |
375 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacement; | 375 | OMV.Vector3 offsetPos = (cPrim.RawPosition - LinksetRoot.RawPosition) * invRootOrientation - centerDisplacementV; |
376 | OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation; | 376 | OMV.Quaternion offsetRot = OMV.Quaternion.Normalize(cPrim.RawOrientation) * invRootOrientation; |
377 | m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); | 377 | m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot); |
378 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", | 378 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}", |
379 | LinksetRoot.LocalID, memberIndex, childShape, offsetPos, offsetRot); | 379 | LinksetRoot.LocalID, memberIndex, childShape, offsetPos, offsetRot); |