Revert "BulletSim: change BSDynamics to expect to be passed a BSPrimLinkable"

The changes don't seem to be ready for prime time.

This reverts commit d0d654e218.
TeleportWork
Robert Adams 2013-07-22 12:08:25 -07:00
parent 84d0699761
commit 7b187deb19
1 changed files with 2 additions and 15 deletions

View File

@ -45,7 +45,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
private static string LogHeader = "[BULLETSIM VEHICLE]"; private static string LogHeader = "[BULLETSIM VEHICLE]";
// the prim this dynamic controller belongs to // the prim this dynamic controller belongs to
private BSPrimLinkable ControllingPrim { get; set; } private BSPrim ControllingPrim { get; set; }
private bool m_haveRegisteredForSceneEvents; private bool m_haveRegisteredForSceneEvents;
@ -128,15 +128,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName) public BSDynamics(BSScene myScene, BSPrim myPrim, string actorName)
: base(myScene, myPrim, actorName) : base(myScene, myPrim, actorName)
{ {
ControllingPrim = myPrim;
Type = Vehicle.TYPE_NONE; Type = Vehicle.TYPE_NONE;
m_haveRegisteredForSceneEvents = false; m_haveRegisteredForSceneEvents = false;
ControllingPrim = myPrim as BSPrimLinkable;
if (ControllingPrim == null)
{
// THIS CANNOT HAPPEN!!
}
VDetailLog("{0},Creation", ControllingPrim.LocalID);
} }
// Return 'true' if this vehicle is doing vehicle things // Return 'true' if this vehicle is doing vehicle things
@ -591,8 +585,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// Friction affects are handled by this vehicle code // Friction affects are handled by this vehicle code
m_physicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction); m_physicsScene.PE.SetFriction(ControllingPrim.PhysBody, BSParam.VehicleFriction);
m_physicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution); m_physicsScene.PE.SetRestitution(ControllingPrim.PhysBody, BSParam.VehicleRestitution);
// ControllingPrim.Linkset.SetPhysicalFriction(BSParam.VehicleFriction);
// ControllingPrim.Linkset.SetPhysicalRestitution(BSParam.VehicleRestitution);
// Moderate angular movement introduced by Bullet. // Moderate angular movement introduced by Bullet.
// TODO: possibly set AngularFactor and LinearFactor for the type of vehicle. // TODO: possibly set AngularFactor and LinearFactor for the type of vehicle.
@ -603,20 +595,17 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// Vehicles report collision events so we know when it's on the ground // Vehicles report collision events so we know when it's on the ground
m_physicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); m_physicsScene.PE.AddToCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
// ControllingPrim.Linkset.SetPhysicalCollisionFlags(CollisionFlags.BS_VEHICLE_COLLISIONS);
Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape.physShapeInfo, m_vehicleMass); Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(ControllingPrim.PhysShape.physShapeInfo, m_vehicleMass);
ControllingPrim.Inertia = inertia * BSParam.VehicleInertiaFactor; ControllingPrim.Inertia = inertia * BSParam.VehicleInertiaFactor;
m_physicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia); m_physicsScene.PE.SetMassProps(ControllingPrim.PhysBody, m_vehicleMass, ControllingPrim.Inertia);
m_physicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody); m_physicsScene.PE.UpdateInertiaTensor(ControllingPrim.PhysBody);
// ControllingPrim.Linkset.ComputeLocalInertia(BSParam.VehicleInertiaFactor);
// Set the gravity for the vehicle depending on the buoyancy // Set the gravity for the vehicle depending on the buoyancy
// TODO: what should be done if prim and vehicle buoyancy differ? // TODO: what should be done if prim and vehicle buoyancy differ?
m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy); m_VehicleGravity = ControllingPrim.ComputeGravity(m_VehicleBuoyancy);
// The actual vehicle gravity is set to zero in Bullet so we can do all the application of same. // The actual vehicle gravity is set to zero in Bullet so we can do all the application of same.
m_physicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero); m_physicsScene.PE.SetGravity(ControllingPrim.PhysBody, Vector3.Zero);
// ControllingPrim.Linkset.SetPhysicalGravity(Vector3.Zero);
VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}", VDetailLog("{0},BSDynamics.SetPhysicalParameters,mass={1},inert={2},vehGrav={3},aDamp={4},frict={5},rest={6},lFact={7},aFact={8}",
ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity, ControllingPrim.LocalID, m_vehicleMass, ControllingPrim.Inertia, m_VehicleGravity,
@ -628,7 +617,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
{ {
if (ControllingPrim.PhysBody.HasPhysicalBody) if (ControllingPrim.PhysBody.HasPhysicalBody)
m_physicsScene.PE.RemoveFromCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS); m_physicsScene.PE.RemoveFromCollisionFlags(ControllingPrim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
// ControllingPrim.Linkset.RemoveFromPhysicalCollisionFlags(CollisionFlags.BS_VEHICLE_COLLISIONS);
} }
} }
@ -641,7 +629,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// BSActor.Release() // BSActor.Release()
public override void Dispose() public override void Dispose()
{ {
VDetailLog("{0},Dispose", ControllingPrim.LocalID);
UnregisterForSceneEvents(); UnregisterForSceneEvents();
Type = Vehicle.TYPE_NONE; Type = Vehicle.TYPE_NONE;
Enabled = false; Enabled = false;