aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs17
1 files changed, 2 insertions, 15 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 82d7c44..1540df1 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -45,7 +45,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
45 private static string LogHeader = "[BULLETSIM VEHICLE]"; 45 private static string LogHeader = "[BULLETSIM VEHICLE]";
46 46
47 // the prim this dynamic controller belongs to 47 // the prim this dynamic controller belongs to
48 private BSPrimLinkable ControllingPrim { get; set; } 48 private BSPrim ControllingPrim { get; set; }
49 49
50 private bool m_haveRegisteredForSceneEvents; 50 private bool m_haveRegisteredForSceneEvents;
51 51
@@ -128,15 +128,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
128 public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName) 128 public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName)
129 : base(myScene, myPrim, actorName) 129 : base(myScene, myPrim, actorName)
130 { 130 {
131 ControllingPrim = myPrim;
131 Type = Vehicle.TYPE_NONE; 132 Type = Vehicle.TYPE_NONE;
132 m_haveRegisteredForSceneEvents = false; 133 m_haveRegisteredForSceneEvents = false;
133
134 ControllingPrim = myPrim as BSPrimLinkable;
135 if (ControllingPrim == null)
136 {
137 // THIS CANNOT HAPPEN!!
138 }
139 VDetailLog("{0},Creation", ControllingPrim.LocalID);
140 } 134 }
141 135
142 // Return 'true' if this vehicle is doing vehicle things 136 // Return 'true' if this vehicle is doing vehicle things
@@ -591,8 +585,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
591 // Friction affects are handled by this vehicle code 585 // Friction affects are handled by this vehicle code
592 m_physicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction); 586 m_physicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction);
593 m_physicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution); 587 m_physicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution);
594 // ControllingPrim.Linkset.SetPhysicalFriction(BSParam.VehicleFriction);
595 // ControllingPrim.Linkset.SetPhysicalRestitution(BSParam.VehicleRestitution);
596 588
597 // Moderate angular movement introduced by Bullet. 589 // Moderate angular movement introduced by Bullet.
598 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. 590 // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle.
@@ -603,20 +595,17 @@ namespace OpenSim.Region.Physics.BulletSPlugin
603 595
604 // Vehicles report collision events so we know when it's on the ground 596 // Vehicles report collision events so we know when it's on the ground
605 m_physicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); 597 m_physicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
606 // ControllingPrim.Linkset.SetPhysicalCollisionFlags(CollisionFlags.BS_VEHICLE_COLLISIONS);
607 598
608 Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape.physShapeInfo, m_vehicleMass); 599 Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape.physShapeInfo, m_vehicleMass);
609 ControllingPrim.Inertia = inertia * BSParam.VehicleInertiaFactor; 600 ControllingPrim.Inertia = inertia * BSParam.VehicleInertiaFactor;
610 m_physicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia); 601 m_physicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia);
611 m_physicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody); 602 m_physicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody);
612 // ControllingPrim.Linkset.ComputeLocalInertia(BSParam.VehicleInertiaFactor);
613 603
614 // Set the gravity for the vehicle depending on the buoyancy 604 // Set the gravity for the vehicle depending on the buoyancy
615 // TODO: what should be done if prim and vehicle buoyancy differ? 605 // TODO: what should be done if prim and vehicle buoyancy differ?
616 m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy); 606 m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy);
617 // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. 607 // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same.
618 m_physicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero); 608 m_physicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero);
619 // ControllingPrim.Linkset.SetPhysicalGravity(Vector3.Zero);
620 609
621 VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", 610 VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}",
622 ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity, 611 ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity,
@@ -628,7 +617,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
628 { 617 {
629 if (ControllingPrim.PhysBody.HasPhysicalBody) 618 if (ControllingPrim.PhysBody.HasPhysicalBody)
630 m_physicsScene.PE.RemoveFromCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); 619 m_physicsScene.PE.RemoveFromCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
631 // ControllingPrim.Linkset.RemoveFromPhysicalCollisionFlags(CollisionFlags.BS_VEHICLE_COLLISIONS);
632 } 620 }
633 } 621 }
634 622
@@ -641,7 +629,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
641 // BSActor.Release() 629 // BSActor.Release()
642 public override void Dispose() 630 public override void Dispose()
643 { 631 {
644 VDetailLog("{0},Dispose", ControllingPrim.LocalID);
645 UnregisterForSceneEvents(); 632 UnregisterForSceneEvents();
646 Type = Vehicle.TYPE_NONE; 633 Type = Vehicle.TYPE_NONE;
647 Enabled = false; 634 Enabled = false;