diff options
author | Robert Adams | 2013-01-31 10:26:53 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-31 15:56:02 -0800 |
commit | ed71c939fc22059b03572fe6380fcc754c89a284 (patch) | |
tree | b10e0be30b391e0e90c855f4cf671fa42d4faf16 /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |
parent | BulletSim: clean up TargetVelocity implementation by using the default defn i... (diff) | |
download | opensim-SC_OLD-ed71c939fc22059b03572fe6380fcc754c89a284.zip opensim-SC_OLD-ed71c939fc22059b03572fe6380fcc754c89a284.tar.gz opensim-SC_OLD-ed71c939fc22059b03572fe6380fcc754c89a284.tar.bz2 opensim-SC_OLD-ed71c939fc22059b03572fe6380fcc754c89a284.tar.xz |
BulletSim: make sure vehicle physical properties are set when going
physical by delaying setting until pre-step time. Change vehicle.Refresh()
to schedule the pre-step setting.
Comments and updating of TODO list.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 05ab180..8ecf2ff 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -581,9 +581,18 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
581 | } | 581 | } |
582 | #endregion // Vehicle parameter setting | 582 | #endregion // Vehicle parameter setting |
583 | 583 | ||
584 | public void Refresh() | ||
585 | { | ||
586 | // If asking for a refresh, reset the physical parameters before the next simulation step. | ||
587 | PhysicsScene.PostTaintObject("BSDynamics.Refresh", Prim.LocalID, delegate() | ||
588 | { | ||
589 | SetPhysicalParameters(); | ||
590 | }); | ||
591 | } | ||
592 | |||
584 | // Some of the properties of this prim may have changed. | 593 | // Some of the properties of this prim may have changed. |
585 | // Do any updating needed for a vehicle | 594 | // Do any updating needed for a vehicle |
586 | public void Refresh() | 595 | private void SetPhysicalParameters() |
587 | { | 596 | { |
588 | if (IsActive) | 597 | if (IsActive) |
589 | { | 598 | { |
@@ -614,7 +623,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
614 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. | 623 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. |
615 | PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero); | 624 | PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero); |
616 | 625 | ||
617 | VDetailLog("{0},BSDynamics.Refresh,mass={1},inert={2},grav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", | 626 | VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", |
618 | Prim.LocalID, m_vehicleMass, Prim.Inertia, m_VehicleGravity, | 627 | Prim.LocalID, m_vehicleMass, Prim.Inertia, m_VehicleGravity, |
619 | BSParam.VehicleAngularDamping, BSParam.VehicleFriction, BSParam.VehicleRestitution, | 628 | BSParam.VehicleAngularDamping, BSParam.VehicleFriction, BSParam.VehicleRestitution, |
620 | BSParam.VehicleLinearFactor, BSParam.VehicleAngularFactor | 629 | BSParam.VehicleLinearFactor, BSParam.VehicleAngularFactor |
@@ -622,26 +631,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
622 | } | 631 | } |
623 | else | 632 | else |
624 | { | 633 | { |
625 | PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | 634 | if (Prim.PhysBody.HasPhysicalBody) |
635 | PhysicsScene.PE.RemoveFromCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | ||
626 | } | 636 | } |
627 | } | 637 | } |
628 | 638 | ||
629 | public bool RemoveBodyDependencies(BSPhysObject prim) | 639 | public bool RemoveBodyDependencies(BSPhysObject prim) |
630 | { | 640 | { |
631 | // If active, we need to add our properties back when the body is rebuilt. | ||
632 | return IsActive; | ||
633 | } | ||
634 | |||
635 | public void RestoreBodyDependencies(BSPhysObject prim) | ||
636 | { | ||
637 | if (Prim.LocalID != prim.LocalID) | ||
638 | { | ||
639 | // The call should be on us by our prim. Error if not. | ||
640 | PhysicsScene.Logger.ErrorFormat("{0} RestoreBodyDependencies: called by not my prim. passedLocalID={1}, vehiclePrimLocalID={2}", | ||
641 | LogHeader, prim.LocalID, Prim.LocalID); | ||
642 | return; | ||
643 | } | ||
644 | Refresh(); | 641 | Refresh(); |
642 | return IsActive; | ||
645 | } | 643 | } |
646 | 644 | ||
647 | #region Known vehicle value functions | 645 | #region Known vehicle value functions |