diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 8b5da0d..0fd1f73 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -565,12 +565,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
565 | m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale, | 565 | m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale, |
566 | m_linearMotorDecayTimescale, m_linearFrictionTimescale, | 566 | m_linearMotorDecayTimescale, m_linearFrictionTimescale, |
567 | 1f); | 567 | 1f); |
568 | m_linearMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG DEBUG (enables detail logging) | 568 | m_linearMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging) |
569 | 569 | ||
570 | m_angularMotor = new BSVMotor("AngularMotor", m_angularMotorTimescale, | 570 | m_angularMotor = new BSVMotor("AngularMotor", m_angularMotorTimescale, |
571 | m_angularMotorDecayTimescale, m_angularFrictionTimescale, | 571 | m_angularMotorDecayTimescale, m_angularFrictionTimescale, |
572 | 1f); | 572 | 1f); |
573 | m_angularMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG DEBUG (enables detail logging) | 573 | m_angularMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG DEBUG (enables detail logging) |
574 | 574 | ||
575 | /* Not implemented | 575 | /* Not implemented |
576 | m_verticalAttractionMotor = new BSVMotor("VerticalAttraction", m_verticalAttractionTimescale, | 576 | m_verticalAttractionMotor = new BSVMotor("VerticalAttraction", m_verticalAttractionTimescale, |
@@ -596,7 +596,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
596 | public override void Refresh() | 596 | public override void Refresh() |
597 | { | 597 | { |
598 | // If asking for a refresh, reset the physical parameters before the next simulation step. | 598 | // If asking for a refresh, reset the physical parameters before the next simulation step. |
599 | PhysicsScene.PostTaintObject("BSDynamics.Refresh", ControllingPrim.LocalID, delegate() | 599 | m_physicsScene.PostTaintObject("BSDynamics.Refresh", ControllingPrim.LocalID, delegate() |
600 | { | 600 | { |
601 | SetPhysicalParameters(); | 601 | SetPhysicalParameters(); |
602 | }); | 602 | }); |
@@ -612,28 +612,28 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
612 | m_vehicleMass = ControllingPrim.TotalMass; | 612 | m_vehicleMass = ControllingPrim.TotalMass; |
613 | 613 | ||
614 | // Friction affects are handled by this vehicle code | 614 | // Friction affects are handled by this vehicle code |
615 | PhysicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction); | 615 | m_physicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction); |
616 | PhysicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution); | 616 | m_physicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution); |
617 | 617 | ||
618 | // Moderate angular movement introduced by Bullet. | 618 | // Moderate angular movement introduced by Bullet. |
619 | // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. | 619 | // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. |
620 | // Maybe compute linear and angular factor and damping from params. | 620 | // Maybe compute linear and angular factor and damping from params. |
621 | PhysicsScene.PE.SetAngularDamping(ControllingPrim.PhysBody, BSParam.VehicleAngularDamping); | 621 | m_physicsScene.PE.SetAngularDamping(ControllingPrim.PhysBody, BSParam.VehicleAngularDamping); |
622 | PhysicsScene.PE.SetLinearFactor(ControllingPrim.PhysBody, BSParam.VehicleLinearFactor); | 622 | m_physicsScene.PE.SetLinearFactor(ControllingPrim.PhysBody, BSParam.VehicleLinearFactor); |
623 | PhysicsScene.PE.SetAngularFactorV(ControllingPrim.PhysBody, BSParam.VehicleAngularFactor); | 623 | m_physicsScene.PE.SetAngularFactorV(ControllingPrim.PhysBody, BSParam.VehicleAngularFactor); |
624 | 624 | ||
625 | // Vehicles report collision events so we know when it's on the ground | 625 | // Vehicles report collision events so we know when it's on the ground |
626 | PhysicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | 626 | m_physicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); |
627 | 627 | ||
628 | ControllingPrim.Inertia = PhysicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape, m_vehicleMass); | 628 | ControllingPrim.Inertia = m_physicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape, m_vehicleMass); |
629 | PhysicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia); | 629 | m_physicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia); |
630 | PhysicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody); | 630 | m_physicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody); |
631 | 631 | ||
632 | // Set the gravity for the vehicle depending on the buoyancy | 632 | // Set the gravity for the vehicle depending on the buoyancy |
633 | // TODO: what should be done if prim and vehicle buoyancy differ? | 633 | // TODO: what should be done if prim and vehicle buoyancy differ? |
634 | m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy); | 634 | m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy); |
635 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. | 635 | // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. |
636 | PhysicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero); | 636 | m_physicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero); |
637 | 637 | ||
638 | VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", | 638 | VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", |
639 | ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity, | 639 | ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity, |
@@ -644,7 +644,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
644 | else | 644 | else |
645 | { | 645 | { |
646 | if (ControllingPrim.PhysBody.HasPhysicalBody) | 646 | if (ControllingPrim.PhysBody.HasPhysicalBody) |
647 | PhysicsScene.PE.RemoveFromCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); | 647 | m_physicsScene.PE.RemoveFromCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); |
648 | } | 648 | } |
649 | } | 649 | } |
650 | 650 | ||
@@ -667,8 +667,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
667 | { | 667 | { |
668 | if (!m_haveRegisteredForSceneEvents) | 668 | if (!m_haveRegisteredForSceneEvents) |
669 | { | 669 | { |
670 | PhysicsScene.BeforeStep += this.Step; | 670 | m_physicsScene.BeforeStep += this.Step; |
671 | PhysicsScene.AfterStep += this.PostStep; | 671 | m_physicsScene.AfterStep += this.PostStep; |
672 | ControllingPrim.OnPreUpdateProperty += this.PreUpdateProperty; | 672 | ControllingPrim.OnPreUpdateProperty += this.PreUpdateProperty; |
673 | m_haveRegisteredForSceneEvents = true; | 673 | m_haveRegisteredForSceneEvents = true; |
674 | } | 674 | } |
@@ -678,8 +678,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
678 | { | 678 | { |
679 | if (m_haveRegisteredForSceneEvents) | 679 | if (m_haveRegisteredForSceneEvents) |
680 | { | 680 | { |
681 | PhysicsScene.BeforeStep -= this.Step; | 681 | m_physicsScene.BeforeStep -= this.Step; |
682 | PhysicsScene.AfterStep -= this.PostStep; | 682 | m_physicsScene.AfterStep -= this.PostStep; |
683 | ControllingPrim.OnPreUpdateProperty -= this.PreUpdateProperty; | 683 | ControllingPrim.OnPreUpdateProperty -= this.PreUpdateProperty; |
684 | m_haveRegisteredForSceneEvents = false; | 684 | m_haveRegisteredForSceneEvents = false; |
685 | } | 685 | } |
@@ -776,7 +776,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
776 | 776 | ||
777 | // If we set one of the values (ie, the physics engine didn't do it) we must force | 777 | // If we set one of the values (ie, the physics engine didn't do it) we must force |
778 | // an UpdateProperties event to send the changes up to the simulator. | 778 | // an UpdateProperties event to send the changes up to the simulator. |
779 | PhysicsScene.PE.PushUpdate(ControllingPrim.PhysBody); | 779 | m_physicsScene.PE.PushUpdate(ControllingPrim.PhysBody); |
780 | } | 780 | } |
781 | m_knownChanged = 0; | 781 | m_knownChanged = 0; |
782 | } | 782 | } |
@@ -967,8 +967,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
967 | // for the physics engine to note the changes so an UpdateProperties event will happen. | 967 | // for the physics engine to note the changes so an UpdateProperties event will happen. |
968 | PushKnownChanged(); | 968 | PushKnownChanged(); |
969 | 969 | ||
970 | if (PhysicsScene.VehiclePhysicalLoggingEnabled) | 970 | if (m_physicsScene.VehiclePhysicalLoggingEnabled) |
971 | PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, ControllingPrim.PhysBody); | 971 | m_physicsScene.PE.DumpRigidBody(m_physicsScene.World, ControllingPrim.PhysBody); |
972 | 972 | ||
973 | VDetailLog("{0},BSDynamics.Step,done,pos={1}, force={2},velocity={3},angvel={4}", | 973 | VDetailLog("{0},BSDynamics.Step,done,pos={1}, force={2},velocity={3},angvel={4}", |
974 | ControllingPrim.LocalID, VehiclePosition, m_knownForce, VehicleVelocity, VehicleRotationalVelocity); | 974 | ControllingPrim.LocalID, VehiclePosition, m_knownForce, VehicleVelocity, VehicleRotationalVelocity); |
@@ -979,8 +979,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
979 | { | 979 | { |
980 | if (!IsActive) return; | 980 | if (!IsActive) return; |
981 | 981 | ||
982 | if (PhysicsScene.VehiclePhysicalLoggingEnabled) | 982 | if (m_physicsScene.VehiclePhysicalLoggingEnabled) |
983 | PhysicsScene.PE.DumpRigidBody(PhysicsScene.World, ControllingPrim.PhysBody); | 983 | m_physicsScene.PE.DumpRigidBody(m_physicsScene.World, ControllingPrim.PhysBody); |
984 | } | 984 | } |
985 | 985 | ||
986 | // Apply the effect of the linear motor and other linear motions (like hover and float). | 986 | // Apply the effect of the linear motor and other linear motions (like hover and float). |