diff options
author | Robert Adams | 2012-12-21 23:24:31 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-21 23:24:31 -0800 |
commit | 5b2cbc0ae69c041abb34d70fd03e4e1a4b7f4ea4 (patch) | |
tree | f51628c336b575d20a41edb0e70b05a5df21be32 /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |
parent | BulletSim: remove the movement decay while flying. Made flying slow down over... (diff) | |
download | opensim-SC_OLD-5b2cbc0ae69c041abb34d70fd03e4e1a4b7f4ea4.zip opensim-SC_OLD-5b2cbc0ae69c041abb34d70fd03e4e1a4b7f4ea4.tar.gz opensim-SC_OLD-5b2cbc0ae69c041abb34d70fd03e4e1a4b7f4ea4.tar.bz2 opensim-SC_OLD-5b2cbc0ae69c041abb34d70fd03e4e1a4b7f4ea4.tar.xz |
BulletSim: remove all special vehicle code from BSScene. Replace per-frame updates for vehicles with per-frame action registration. One fewer special case.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index d137b2a..26b8df5 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -465,15 +465,18 @@ public sealed class BSPrim : BSPhysObject | |||
465 | set { | 465 | set { |
466 | Vehicle type = (Vehicle)value; | 466 | Vehicle type = (Vehicle)value; |
467 | 467 | ||
468 | // Tell the scene about the vehicle so it will get processing each frame. | ||
469 | PhysicsScene.VehicleInSceneTypeChanged(this, type); | ||
470 | |||
471 | PhysicsScene.TaintedObject("setVehicleType", delegate() | 468 | PhysicsScene.TaintedObject("setVehicleType", delegate() |
472 | { | 469 | { |
473 | // Done at taint time so we're sure the physics engine is not using the variables | 470 | // Done at taint time so we're sure the physics engine is not using the variables |
474 | // Vehicle code changes the parameters for this vehicle type. | 471 | // Vehicle code changes the parameters for this vehicle type. |
475 | _vehicle.ProcessTypeChange(type); | 472 | _vehicle.ProcessTypeChange(type); |
476 | ActivateIfPhysical(false); | 473 | ActivateIfPhysical(false); |
474 | |||
475 | // If an active vehicle, register the vehicle code to be called before each step | ||
476 | if (_vehicle.Type == Vehicle.TYPE_NONE) | ||
477 | UnRegisterPreStepAction("BSPrim.Vehicle", LocalID); | ||
478 | else | ||
479 | RegisterPreStepAction("BSPrim.Vehicle", LocalID, _vehicle.Step); | ||
477 | }); | 480 | }); |
478 | } | 481 | } |
479 | } | 482 | } |
@@ -509,23 +512,6 @@ public sealed class BSPrim : BSPhysObject | |||
509 | }); | 512 | }); |
510 | } | 513 | } |
511 | 514 | ||
512 | // Called each simulation step to advance vehicle characteristics. | ||
513 | // Called from Scene when doing simulation step so we're in taint processing time. | ||
514 | public override void StepVehicle(float timeStep) | ||
515 | { | ||
516 | if (IsPhysical && _vehicle.IsActive) | ||
517 | { | ||
518 | _vehicle.Step(timeStep); | ||
519 | /* // TEST TEST DEBUG DEBUG -- trying to reduce the extra action of Bullet simulation step | ||
520 | PhysicsScene.PostTaintObject("BSPrim.StepVehicles", LocalID, delegate() | ||
521 | { | ||
522 | // This resets the interpolation values and recomputes the tensor variables | ||
523 | BulletSimAPI.SetCenterOfMassByPosRot2(BSBody.ptr, ForcePosition, ForceOrientation); | ||
524 | }); | ||
525 | */ | ||
526 | } | ||
527 | } | ||
528 | |||
529 | // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more | 515 | // Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more |
530 | public override void SetVolumeDetect(int param) { | 516 | public override void SetVolumeDetect(int param) { |
531 | bool newValue = (param != 0); | 517 | bool newValue = (param != 0); |