diff options
author | Robert Adams | 2013-01-23 09:09:17 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-23 14:25:18 -0800 |
commit | a5e9c665f08059fef16d0b0875697cb08e16351e (patch) | |
tree | 61d11e9cb950fb7fe780dc96466bc8ba426937b9 /OpenSim | |
parent | BulletSim: working on COM (diff) | |
download | opensim-SC_OLD-a5e9c665f08059fef16d0b0875697cb08e16351e.zip opensim-SC_OLD-a5e9c665f08059fef16d0b0875697cb08e16351e.tar.gz opensim-SC_OLD-a5e9c665f08059fef16d0b0875697cb08e16351e.tar.bz2 opensim-SC_OLD-a5e9c665f08059fef16d0b0875697cb08e16351e.tar.xz |
BulletSim: center-of-gravity linkset changes. Not working yet.
Conflicts:
OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
Diffstat (limited to 'OpenSim')
4 files changed, 9 insertions, 29 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index d8e4028..2c8dd23 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -407,6 +407,9 @@ public sealed class BSLinksetCompound : BSLinkset | |||
407 | // Since we're displacing the center of the shape, we need to move the body in the world | 407 | // Since we're displacing the center of the shape, we need to move the body in the world |
408 | LinksetRoot.PositionDisplacement = centerDisplacement; | 408 | LinksetRoot.PositionDisplacement = centerDisplacement; |
409 | 409 | ||
410 | // This causes the root prim position to be set properly based on the new PositionDisplacement | ||
411 | LinksetRoot.ForcePosition = LinksetRoot.RawPosition; | ||
412 | // Update the local transform for the root child shape so it is offset from the <0,0,0> which is COM | ||
410 | PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, 0, -centerDisplacement, OMV.Quaternion.Identity, false); | 413 | PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, 0, -centerDisplacement, OMV.Quaternion.Identity, false); |
411 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}", | 414 | DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}", |
412 | LinksetRoot.LocalID, centerOfMass, LinksetRoot.RawPosition, centerDisplacement); | 415 | LinksetRoot.LocalID, centerOfMass, LinksetRoot.RawPosition, centerDisplacement); |
@@ -438,7 +441,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
438 | 441 | ||
439 | if (cPrim.PhysShape.isNativeShape) | 442 | if (cPrim.PhysShape.isNativeShape) |
440 | { | 443 | { |
441 | // A native shape is turning into a hull collision shape because native | 444 | // A native shape is turned into a hull collision shape because native |
442 | // shapes are not shared so we have to hullify it so it will be tracked | 445 | // shapes are not shared so we have to hullify it so it will be tracked |
443 | // and freed at the correct time. This also solves the scaling problem | 446 | // and freed at the correct time. This also solves the scaling problem |
444 | // (native shapes scaled but hull/meshes are assumed to not be). | 447 | // (native shapes scaled but hull/meshes are assumed to not be). |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index da7438a..9460daf 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -645,11 +645,8 @@ public static class BSParam | |||
645 | entries.Add(new PhysParameterEntry(pd.name, pd.desc)); | 645 | entries.Add(new PhysParameterEntry(pd.name, pd.desc)); |
646 | } | 646 | } |
647 | 647 | ||
648 | // make the list in alphabetical order for estetic reasons | 648 | // make the list alphabetical for estetic reasons |
649 | entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2) | 649 | entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); }); |
650 | { | ||
651 | return ppe1.name.CompareTo(ppe2.name); | ||
652 | }); | ||
653 | 650 | ||
654 | SettableParameters = entries.ToArray(); | 651 | SettableParameters = entries.ToArray(); |
655 | } | 652 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index dad7250..ee2bfa0 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -322,6 +322,7 @@ public sealed class BSPrim : BSPhysObject | |||
322 | }); | 322 | }); |
323 | } | 323 | } |
324 | } | 324 | } |
325 | |||
325 | public override OMV.Vector3 ForcePosition { | 326 | public override OMV.Vector3 ForcePosition { |
326 | get { | 327 | get { |
327 | _position = PhysicsScene.PE.GetPosition(PhysBody) - PositionDisplacement; | 328 | _position = PhysicsScene.PE.GetPosition(PhysBody) - PositionDisplacement; |
@@ -336,27 +337,6 @@ public sealed class BSPrim : BSPhysObject | |||
336 | } | 337 | } |
337 | } | 338 | } |
338 | } | 339 | } |
339 | /* Disable. Presume whoever is setting displacement is already adjusting position, etc. | ||
340 | // Override to have position displacement immediately update the physical position. | ||
341 | // A feeble attempt to keep the sim and physical positions in sync | ||
342 | // Must be called at taint time. | ||
343 | public override OMV.Vector3 PositionDisplacement | ||
344 | { | ||
345 | get | ||
346 | { | ||
347 | return base.PositionDisplacement; | ||
348 | } | ||
349 | set | ||
350 | { | ||
351 | base.PositionDisplacement = value; | ||
352 | PhysicsScene.TaintedObject(PhysicsScene.InTaintTime, "BSPrim.setPosition", delegate() | ||
353 | { | ||
354 | if (PhysBody.HasPhysicalBody) | ||
355 | PhysicsScene.PE.SetTranslation(PhysBody, _position + base.PositionDisplacement, _orientation); | ||
356 | }); | ||
357 | } | ||
358 | } | ||
359 | */ | ||
360 | 340 | ||
361 | // Check that the current position is sane and, if not, modify the position to make it so. | 341 | // Check that the current position is sane and, if not, modify the position to make it so. |
362 | // Check for being below terrain and being out of bounds. | 342 | // Check for being below terrain and being out of bounds. |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 8075b73..34fd2a0 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -708,8 +708,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
708 | // TriggerPreStepEvent | 708 | // TriggerPreStepEvent |
709 | // DoOneTimeTaints | 709 | // DoOneTimeTaints |
710 | // Step() | 710 | // Step() |
711 | // ProcessAndForwardCollisions | 711 | // ProcessAndSendToSimulatorCollisions |
712 | // ProcessAndForwardPropertyUpdates | 712 | // ProcessAndSendToSimulatorPropertyUpdates |
713 | // TriggerPostStepEvent | 713 | // TriggerPostStepEvent |
714 | 714 | ||
715 | // Calls to the PhysicsActors can't directly call into the physics engine | 715 | // Calls to the PhysicsActors can't directly call into the physics engine |