diff options
author | Robert Adams | 2013-01-18 11:37:36 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-18 11:37:36 -0800 |
commit | 482c7b5368faa034b73b3434fd90ce3702644cb8 (patch) | |
tree | fa0a9f3e314b6059dcff7c5c70349a275c7d166c /OpenSim | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-482c7b5368faa034b73b3434fd90ce3702644cb8.zip opensim-SC-482c7b5368faa034b73b3434fd90ce3702644cb8.tar.gz opensim-SC-482c7b5368faa034b73b3434fd90ce3702644cb8.tar.bz2 opensim-SC-482c7b5368faa034b73b3434fd90ce3702644cb8.tar.xz |
BulletSim: add logic to turn off pre-step actions when object goes
non-active. This turns off 'setForce', 'setTorque' and 'moveToTarget'
when the object is selected or made non-physical.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 7aa2d92..aaa6fe5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -502,6 +502,12 @@ public sealed class BSPrim : BSPhysObject | |||
502 | RegisterPreStepAction("BSPrim.setForce", LocalID, | 502 | RegisterPreStepAction("BSPrim.setForce", LocalID, |
503 | delegate(float timeStep) | 503 | delegate(float timeStep) |
504 | { | 504 | { |
505 | if (!IsPhysicallyActive) | ||
506 | { | ||
507 | UnRegisterPreStepAction("BSPrim.setForce", LocalID); | ||
508 | return; | ||
509 | } | ||
510 | |||
505 | DetailLog("{0},BSPrim.setForce,preStep,force={1}", LocalID, _force); | 511 | DetailLog("{0},BSPrim.setForce,preStep,force={1}", LocalID, _force); |
506 | if (PhysBody.HasPhysicalBody) | 512 | if (PhysBody.HasPhysicalBody) |
507 | { | 513 | { |
@@ -627,6 +633,12 @@ public sealed class BSPrim : BSPhysObject | |||
627 | RegisterPreStepAction("BSPrim.setTorque", LocalID, | 633 | RegisterPreStepAction("BSPrim.setTorque", LocalID, |
628 | delegate(float timeStep) | 634 | delegate(float timeStep) |
629 | { | 635 | { |
636 | if (!IsPhysicallyActive) | ||
637 | { | ||
638 | UnRegisterPreStepAction("BSPrim.setTorque", LocalID); | ||
639 | return; | ||
640 | } | ||
641 | |||
630 | if (PhysBody.HasPhysicalBody) | 642 | if (PhysBody.HasPhysicalBody) |
631 | AddAngularForce(_torque, false, true); | 643 | AddAngularForce(_torque, false, true); |
632 | } | 644 | } |
@@ -1061,6 +1073,12 @@ public sealed class BSPrim : BSPhysObject | |||
1061 | 1073 | ||
1062 | RegisterPreStepAction("BSPrim.PIDTarget", LocalID, delegate(float timeStep) | 1074 | RegisterPreStepAction("BSPrim.PIDTarget", LocalID, delegate(float timeStep) |
1063 | { | 1075 | { |
1076 | if (!IsPhysicallyActive) | ||
1077 | { | ||
1078 | UnRegisterPreStepAction("BSPrim.PIDTarget", LocalID); | ||
1079 | return; | ||
1080 | } | ||
1081 | |||
1064 | OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below) | 1082 | OMV.Vector3 origPosition = RawPosition; // DEBUG DEBUG (for printout below) |
1065 | 1083 | ||
1066 | // 'movePosition' is where we'd like the prim to be at this moment. | 1084 | // 'movePosition' is where we'd like the prim to be at this moment. |
@@ -1108,6 +1126,9 @@ public sealed class BSPrim : BSPhysObject | |||
1108 | 1126 | ||
1109 | RegisterPreStepAction("BSPrim.Hover", LocalID, delegate(float timeStep) | 1127 | RegisterPreStepAction("BSPrim.Hover", LocalID, delegate(float timeStep) |
1110 | { | 1128 | { |
1129 | if (!IsPhysicallyActive) | ||
1130 | return; | ||
1131 | |||
1111 | _hoverMotor.SetCurrent(RawPosition.Z); | 1132 | _hoverMotor.SetCurrent(RawPosition.Z); |
1112 | _hoverMotor.SetTarget(ComputeCurrentPIDHoverHeight()); | 1133 | _hoverMotor.SetTarget(ComputeCurrentPIDHoverHeight()); |
1113 | float targetHeight = _hoverMotor.Step(timeStep); | 1134 | float targetHeight = _hoverMotor.Step(timeStep); |