BulletSim: fix compile errors from last commit. Clean up passing of physics scene into vehicle dynamics code.
parent
cda67a68de
commit
7451bb1613
|
@ -57,7 +57,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
private int frcount = 0; // Used to limit dynamics debug output to
|
private int frcount = 0; // Used to limit dynamics debug output to
|
||||||
// every 100th frame
|
// every 100th frame
|
||||||
|
|
||||||
// private BSScene m_parentScene = null;
|
|
||||||
private BSPrim m_prim; // the prim this dynamic controller belongs to
|
private BSPrim m_prim; // the prim this dynamic controller belongs to
|
||||||
|
|
||||||
// Vehicle properties
|
// Vehicle properties
|
||||||
|
@ -602,7 +601,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
}
|
}
|
||||||
}//end SetDefaultsForType
|
}//end SetDefaultsForType
|
||||||
|
|
||||||
internal void Step(float pTimestep, BSScene pParentScene)
|
internal void Step(float pTimestep)
|
||||||
{
|
{
|
||||||
if (m_type == Vehicle.TYPE_NONE) return;
|
if (m_type == Vehicle.TYPE_NONE) return;
|
||||||
|
|
||||||
|
@ -610,14 +609,15 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
if (frcount > 100)
|
if (frcount > 100)
|
||||||
frcount = 0;
|
frcount = 0;
|
||||||
|
|
||||||
MoveLinear(pTimestep, pParentScene);
|
MoveLinear(pTimestep);
|
||||||
MoveAngular(pTimestep);
|
MoveAngular(pTimestep);
|
||||||
LimitRotation(pTimestep);
|
LimitRotation(pTimestep);
|
||||||
DetailLog("{0},step,pos={1},force={2},velocity={3},angvel={4}",
|
|
||||||
|
DetailLog("{0},step,done,pos={1},force={2},velocity={3},angvel={4}",
|
||||||
m_prim.LocalID, m_prim.Position, m_prim.Force, m_prim.Velocity, m_prim.RotationalVelocity);
|
m_prim.LocalID, m_prim.Position, m_prim.Force, m_prim.Velocity, m_prim.RotationalVelocity);
|
||||||
}// end Step
|
}// end Step
|
||||||
|
|
||||||
private void MoveLinear(float pTimestep, BSScene _pParentScene)
|
private void MoveLinear(float pTimestep)
|
||||||
{
|
{
|
||||||
if (!m_linearMotorDirection.ApproxEquals(Vector3.Zero, 0.01f)) // requested m_linearMotorDirection is significant
|
if (!m_linearMotorDirection.ApproxEquals(Vector3.Zero, 0.01f)) // requested m_linearMotorDirection is significant
|
||||||
{
|
{
|
||||||
|
@ -664,7 +664,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
Vector3 grav = Vector3.Zero;
|
Vector3 grav = Vector3.Zero;
|
||||||
// There is some gravity, make a gravity force vector that is applied after object velocity.
|
// There is some gravity, make a gravity force vector that is applied after object velocity.
|
||||||
// m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
|
// m_VehicleBuoyancy: -1=2g; 0=1g; 1=0g;
|
||||||
grav.Z = _pParentScene.DefaultGravity.Z * m_prim.Mass * (1f - m_VehicleBuoyancy);
|
grav.Z = m_prim.Scene.DefaultGravity.Z * m_prim.Mass * (1f - m_VehicleBuoyancy);
|
||||||
// Preserve the current Z velocity
|
// Preserve the current Z velocity
|
||||||
Vector3 vel_now = m_prim.Velocity;
|
Vector3 vel_now = m_prim.Velocity;
|
||||||
m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
|
m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity
|
||||||
|
@ -708,9 +708,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
m_prim.LocalID, m_BlockingEndPoint, posChange, pos);
|
m_prim.LocalID, m_BlockingEndPoint, posChange, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pos.Z < _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y))
|
if (pos.Z < m_prim.Scene.GetTerrainHeightAtXY(pos.X, pos.Y))
|
||||||
{
|
{
|
||||||
pos.Z = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + 2;
|
pos.Z = m_prim.Scene.GetTerrainHeightAtXY(pos.X, pos.Y) + 2;
|
||||||
m_prim.Position = pos;
|
m_prim.Position = pos;
|
||||||
DetailLog("{0},MoveLinear,terrainHeight,pos={1}", m_prim.LocalID, pos);
|
DetailLog("{0},MoveLinear,terrainHeight,pos={1}", m_prim.LocalID, pos);
|
||||||
}
|
}
|
||||||
|
@ -721,11 +721,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
// We should hover, get the target height
|
// We should hover, get the target height
|
||||||
if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != 0)
|
if ((m_Hoverflags & VehicleFlag.HOVER_WATER_ONLY) != 0)
|
||||||
{
|
{
|
||||||
m_VhoverTargetHeight = _pParentScene.GetWaterLevel() + m_VhoverHeight;
|
m_VhoverTargetHeight = m_prim.Scene.GetWaterLevel() + m_VhoverHeight;
|
||||||
}
|
}
|
||||||
if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0)
|
if ((m_Hoverflags & VehicleFlag.HOVER_TERRAIN_ONLY) != 0)
|
||||||
{
|
{
|
||||||
m_VhoverTargetHeight = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight;
|
m_VhoverTargetHeight = m_prim.Scene.GetTerrainHeightAtXY(pos.X, pos.Y) + m_VhoverHeight;
|
||||||
}
|
}
|
||||||
if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0)
|
if ((m_Hoverflags & VehicleFlag.HOVER_GLOBAL_HEIGHT) != 0)
|
||||||
{
|
{
|
||||||
|
@ -789,7 +789,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
{
|
{
|
||||||
grav.Z = (float)(grav.Z * 1.125);
|
grav.Z = (float)(grav.Z * 1.125);
|
||||||
}
|
}
|
||||||
float terraintemp = _pParentScene.GetTerrainHeightAtXYZ(pos);
|
float terraintemp = m_prim.Scene.GetTerrainHeightAtXYZ(pos);
|
||||||
float postemp = (pos.Z - terraintemp);
|
float postemp = (pos.Z - terraintemp);
|
||||||
if (postemp > 2.5f)
|
if (postemp > 2.5f)
|
||||||
{
|
{
|
||||||
|
@ -940,7 +940,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
DetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", m_prim.LocalID, decayamount, m_lastAngularVelocity);
|
DetailLog("{0},MoveAngular,done,decay={1},lastAngular={2}", m_prim.LocalID, decayamount, m_lastAngularVelocity);
|
||||||
} //end MoveAngular
|
} //end MoveAngular
|
||||||
|
|
||||||
} //end MoveAngular
|
|
||||||
internal void LimitRotation(float timestep)
|
internal void LimitRotation(float timestep)
|
||||||
{
|
{
|
||||||
Quaternion rotq = m_prim.Orientation;
|
Quaternion rotq = m_prim.Orientation;
|
||||||
|
|
|
@ -149,7 +149,7 @@ public sealed class BSPrim : PhysicsActor
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID);
|
// m_log.DebugFormat("{0}: Destroy, id={1}", LogHeader, LocalID);
|
||||||
// Undo any vehicle properties
|
// Undo any vehicle properties
|
||||||
_vehicle.ProcessTypeChange(Vehicle.TYPE_NONE, 1f);
|
_vehicle.ProcessTypeChange(Vehicle.TYPE_NONE);
|
||||||
_scene.RemoveVehiclePrim(this); // just to make sure
|
_scene.RemoveVehiclePrim(this); // just to make sure
|
||||||
|
|
||||||
// undo any dependance with/on other objects
|
// undo any dependance with/on other objects
|
||||||
|
@ -354,7 +354,7 @@ public sealed class BSPrim : PhysicsActor
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
Vehicle type = (Vehicle)value;
|
Vehicle type = (Vehicle)value;
|
||||||
_vehicle.ProcessTypeChange(type, _scene.LastSimulatedTimestep);
|
_vehicle.ProcessTypeChange(type);
|
||||||
_scene.TaintedObject(delegate()
|
_scene.TaintedObject(delegate()
|
||||||
{
|
{
|
||||||
if (type == Vehicle.TYPE_NONE)
|
if (type == Vehicle.TYPE_NONE)
|
||||||
|
@ -389,7 +389,7 @@ public sealed class BSPrim : PhysicsActor
|
||||||
// Called each simulation step to advance vehicle characteristics
|
// Called each simulation step to advance vehicle characteristics
|
||||||
public void StepVehicle(float timeStep)
|
public void StepVehicle(float timeStep)
|
||||||
{
|
{
|
||||||
_vehicle.Step(timeStep, _scene);
|
_vehicle.Step(timeStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
|
// Allows the detection of collisions with inherently non-physical prims. see llVolumeDetect for more
|
||||||
|
|
Loading…
Reference in New Issue