BulletSim: add ini file and command line parameters to control

dumping of physical vehicle parameters (out of Bullet) on each
simulation step and to optionally scale vehicle angular velocity
by the time step. The latter looks to be part of a difference
between angular parameters for ODE and BulletSim. SL docs say
angular velocity is measured in radians/timeScale. Not sure if this
is different than what ODE does.
0.7.5-pf-bulletsim
Robert Adams 2012-12-11 00:13:13 -08:00
parent ebf30e7ba6
commit 8b861e880a
4 changed files with 22 additions and 8 deletions

View File

@ -570,8 +570,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia); BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia);
BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr); BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr);
VDetailLog("{0},BSDynamics.Refresh,frict={1},inert={2},aDamp={3}", VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4}",
Prim.LocalID, friction, localInertia, angularDamping); Prim.LocalID, m_vehicleMass, friction, localInertia, angularDamping);
} }
else else
{ {
@ -1057,7 +1057,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// TODO: Should this be applied as an angular force (torque)? // TODO: Should this be applied as an angular force (torque)?
if (!m_lastAngularCorrection.ApproxEquals(Vector3.Zero, 0.01f)) if (!m_lastAngularCorrection.ApproxEquals(Vector3.Zero, 0.01f))
{ {
Vector3 scaledCorrection = m_lastAngularCorrection * pTimestep; // DEBUG DEBUG DEBUG: optionally scale the angular velocity. Debugging SL vs ODE turning functions.
Vector3 scaledCorrection = m_lastAngularCorrection;
if (PhysicsScene.VehicleScaleAngularVelocityByTimestep)
scaledCorrection *= pTimestep;
VehicleRotationalVelocity = scaledCorrection; VehicleRotationalVelocity = scaledCorrection;
VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5},scaledCorr={6}", VDetailLog("{0}, MoveAngular,done,nonZero,angMotorContrib={1},vertAttrContrib={2},bankContrib={3},deflectContrib={4},totalContrib={5},scaledCorr={6}",

View File

@ -188,6 +188,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
private bool m_physicsLoggingDoFlush; private bool m_physicsLoggingDoFlush;
// 'true' of the vehicle code is to log lots of details // 'true' of the vehicle code is to log lots of details
public bool VehicleLoggingEnabled { get; private set; } public bool VehicleLoggingEnabled { get; private set; }
public bool VehiclePhysicalLoggingEnabled { get; private set; }
public bool VehicleScaleAngularVelocityByTimestep { get; private set; }
#region Construction and Initialization #region Construction and Initialization
public BSScene(string identifier) public BSScene(string identifier)
@ -297,6 +299,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false); m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false);
// Very detailed logging for vehicle debugging // Very detailed logging for vehicle debugging
VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false);
VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false);
// Do any replacements in the parameters // Do any replacements in the parameters
m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName); m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName);
@ -501,7 +504,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
try try
{ {
// if (VehicleLoggingEnabled) DumpVehicles(); // DEBUG if (VehiclePhysicalLoggingEnabled) DumpVehicles(); // DEBUG
if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount(); if (PhysicsLogging.Enabled) beforeTime = Util.EnvironmentTickCount();
numSubSteps = BulletSimAPI.PhysicsStep2(World.ptr, timeStep, m_maxSubSteps, m_fixedTimeStep, numSubSteps = BulletSimAPI.PhysicsStep2(World.ptr, timeStep, m_maxSubSteps, m_fixedTimeStep,
@ -510,7 +513,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime);
DetailLog("{0},Simulate,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}", DetailLog("{0},Simulate,call, frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}",
DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, updatedEntityCount, collidersCount); DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, updatedEntityCount, collidersCount);
// if (VehicleLoggingEnabled) DumpVehicles(); // DEBUG if (VehiclePhysicalLoggingEnabled) DumpVehicles(); // DEBUG
} }
catch (Exception e) catch (Exception e)
{ {
@ -1226,6 +1229,11 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
(s,cf,p,v) => { s.m_params[0].vehicleAngularDamping = cf.GetFloat(p, v); }, (s,cf,p,v) => { s.m_params[0].vehicleAngularDamping = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].vehicleAngularDamping; }, (s) => { return s.m_params[0].vehicleAngularDamping; },
(s,p,l,v) => { s.m_params[0].vehicleAngularDamping = v; } ), (s,p,l,v) => { s.m_params[0].vehicleAngularDamping = v; } ),
new ParameterDefn("VehicleScaleAngularVelocityByTimestep", "If true, scale angular turning by timestep",
ConfigurationParameters.numericFalse,
(s,cf,p,v) => { s.VehicleScaleAngularVelocityByTimestep = cf.GetBoolean(p, s.BoolNumeric(v)); },
(s) => { return s.NumericBool(s.VehicleScaleAngularVelocityByTimestep); },
(s,p,l,v) => { s.VehicleScaleAngularVelocityByTimestep = s.BoolNumeric(v); } ),
new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)", new ParameterDefn("MaxPersistantManifoldPoolSize", "Number of manifolds pooled (0 means default of 4096)",
0f, 0f,

View File

@ -793,7 +793,7 @@ public sealed class BSShapeCollection : IDisposable
BulletShape newShape = new BulletShape(hullPtr, BSPhysicsShapeType.SHAPE_HULL); BulletShape newShape = new BulletShape(hullPtr, BSPhysicsShapeType.SHAPE_HULL);
newShape.shapeKey = newHullKey; newShape.shapeKey = newHullKey;
return newShape; // 'true' means a new shape has been added to this prim return newShape;
} }
// Callback from convex hull creater with a newly created hull. // Callback from convex hull creater with a newly created hull.

View File

@ -38,7 +38,8 @@ Disable activity of passive linkset children.
Scenes with hundred of thousands of static objects take a lot of physics CPU time. Scenes with hundred of thousands of static objects take a lot of physics CPU time.
BSPrim.Force should set a continious force on the prim. The force should be BSPrim.Force should set a continious force on the prim. The force should be
applied each tick. Some limits? applied each tick. Some limits?
Single prim vehicles don't seem to properly vehiclize. Linksets should allow collisions to individual children
Add LocalID to children shapes in LinksetCompound and create events for individuals
Gun sending shooter flying. Gun sending shooter flying.
Collision margin (gap between physical objects lying on each other) Collision margin (gap between physical objects lying on each other)
Boundry checking (crashes related to crossing boundry) Boundry checking (crashes related to crossing boundry)
@ -146,3 +147,5 @@ Light cycle falling over when driving (Resolution: implemented VerticalAttractor
Light cycle not banking (Resolution: It doesn't. Banking is roll adding yaw.) Light cycle not banking (Resolution: It doesn't. Banking is roll adding yaw.)
Package Bullet source mods for Bullet internal stats output Package Bullet source mods for Bullet internal stats output
(Resolution: move code into WorldData.h rather than relying on patches) (Resolution: move code into WorldData.h rather than relying on patches)
Single prim vehicles don't seem to properly vehiclize.
(Resolution: mass was not getting set properly for single prim linksets)