BulletSim: apply friction to linear and angular motion before returning advanced motor value. This seems to be the problem with BulletSim vehicles turning too quickly. Also removed the configuration parameter that controlled the timestep scaling kludge for angular velocity that was added to research the question of quick turning.

0.7.5-pf-bulletsim
Robert Adams 2012-12-17 13:51:39 -08:00
parent 11532a4390
commit 8653ea93b2
3 changed files with 2 additions and 14 deletions

View File

@ -1051,12 +1051,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// ==================================================================
m_lastVertAttractor = verticalAttractionContribution;
// DEBUG DEBUG DEBUG: optionally scale the angular velocity. Debugging SL vs ODE turning functions.
Vector3 originalAngularMotorContrib = angularMotorContribution;
if (PhysicsScene.VehicleScaleAngularVelocityByTimestep)
angularMotorContribution *= pTimestep;
// Sum corrections
m_lastAngularVelocity = angularMotorContribution
+ verticalAttractionContribution
+ deflectionContribution

View File

@ -134,8 +134,6 @@ public class BSVMotor : BSMotor
Vector3 addAmount = (TargetValue - CurrentValue)/TimeScale * timeStep;
CurrentValue += addAmount;
returnCurrent = CurrentValue;
// The desired value reduces to zero which also reduces the difference with current.
// If the decay time is infinite, don't decay at all.
float decayFactor = 0f;
@ -156,6 +154,8 @@ public class BSVMotor : BSMotor
CurrentValue *= (Vector3.One - frictionFactor);
}
returnCurrent = CurrentValue;
MDetailLog("{0}, BSVMotor.Step,nonZero,{1},origCurr={2},origTarget={3},timeStep={4},timeScale={5},addAmnt={6},targetDecay={7},decayFact={8},fricTS={9},frictFact={10}",
BSScene.DetailLogZero, UseName, origCurrVal, origTarget,
timeStep, TimeScale, addAmount,

View File

@ -189,7 +189,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
// 'true' of the vehicle code is to log lots of details
public bool VehicleLoggingEnabled { get; private set; }
public bool VehiclePhysicalLoggingEnabled { get; private set; }
public bool VehicleScaleAngularVelocityByTimestep { get; private set; }
#region Construction and Initialization
public BSScene(string identifier)
@ -1239,11 +1238,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
(s,cf,p,v) => { s.m_params[0].vehicleAngularDamping = cf.GetFloat(p, v); },
(s) => { return s.m_params[0].vehicleAngularDamping; },
(s,p,l,v) => { s.m_params[0].vehicleAngularDamping = v; } ),
new ParameterDefn("VehicleScaleAngularVelocityByTimestep", "If true, scale angular turning by timestep",
ConfigurationParameters.numericTrue,
(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)",
0f,