BulletSim: parameterize several vehicle debugging values: physical linear and angular force factors now default to less than 1 (0.2) vehicle friction and restitution now default to low values

user_profiles
Robert Adams 2013-01-25 12:00:19 -08:00
parent c44a8e9f92
commit dd08e1fba6
3 changed files with 57 additions and 9 deletions

View File

@ -583,8 +583,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// Some of the properties of this prim may have changed.
// Do any updating needed for a vehicle
Vector3 m_physicsLinearFactor = new Vector3(0.2f, 0.2f, 0.2f); // DEBUG DEBUG
Vector3 m_physicsAngularFactor = new Vector3(0.2f, 0.2f, 0.2f); // DEBUG DEBUG
public void Refresh()
{
if (IsActive)
@ -593,16 +591,16 @@ namespace OpenSim.Region.Physics.BulletSPlugin
m_vehicleMass = Prim.Linkset.LinksetMass;
// Friction affects are handled by this vehicle code
float friction = 0f;
PhysicsScene.PE.SetFriction(Prim.PhysBody, friction);
PhysicsScene.PE.SetFriction(Prim.PhysBody, BSParam.VehicleFriction);
PhysicsScene.PE.SetRestitution(Prim.PhysBody, BSParam.VehicleRestitution);
// Moderate angular movement introduced by Bullet.
// TODO: possibly set AngularFactor and LinearFactor for the type of vehicle.
// Maybe compute linear and angular factor and damping from params.
float angularDamping = BSParam.VehicleAngularDamping;
PhysicsScene.PE.SetAngularDamping(Prim.PhysBody, angularDamping);
PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, m_physicsLinearFactor); // DEBUG DEBUG
PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, m_physicsAngularFactor); // DEBUG DEBUG
PhysicsScene.PE.SetLinearFactor(Prim.PhysBody, BSParam.VehicleLinearFactorV);
PhysicsScene.PE.SetAngularFactorV(Prim.PhysBody, BSParam.VehicleAngularFactorV);
// Vehicles report collision events so we know when it's on the ground
PhysicsScene.PE.AddToCollisionFlags(Prim.PhysBody, CollisionFlags.BS_VEHICLE_COLLISIONS);
@ -618,7 +616,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
PhysicsScene.PE.SetGravity(Prim.PhysBody, Vector3.Zero);
VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4},grav={5}",
Prim.LocalID, m_vehicleMass, friction, Prim.Inertia, angularDamping, m_VehicleGravity);
Prim.LocalID, m_vehicleMass, Prim.Inertia, angularDamping, m_VehicleGravity);
}
else
{

View File

@ -82,9 +82,34 @@ public static class BSParam
public static float AvatarStepApproachFactor { get; private set; }
public static float AvatarStepForceFactor { get; private set; }
// Vehicle parameters
public static float VehicleMaxLinearVelocity { get; private set; }
public static float VehicleMaxAngularVelocity { get; private set; }
public static float VehicleAngularDamping { get; private set; }
public static float VehicleFriction { get; private set; }
public static float VehicleRestitution { get; private set; }
public static float VehicleLinearFactor { get; private set; }
private static Vector3? vehicleLinearFactorV;
public static Vector3 VehicleLinearFactorV
{
get
{
if (!vehicleLinearFactorV.HasValue)
vehicleLinearFactorV = new Vector3(VehicleLinearFactor, VehicleLinearFactor, VehicleLinearFactor);
return (Vector3)vehicleLinearFactorV;
}
}
public static float VehicleAngularFactor { get; private set; }
private static Vector3? vehicleAngularFactorV;
public static Vector3 VehicleAngularFactorV
{
get
{
if (!vehicleAngularFactorV.HasValue)
vehicleAngularFactorV = new Vector3(VehicleAngularFactor, VehicleAngularFactor, VehicleAngularFactor);
return (Vector3)vehicleAngularFactorV;
}
}
public static float VehicleDebuggingEnabled { get; private set; }
public static float LinksetImplementation { get; private set; }
@ -454,6 +479,26 @@ public static class BSParam
(s,cf,p,v) => { VehicleAngularDamping = cf.GetFloat(p, v); },
(s) => { return VehicleAngularDamping; },
(s,p,l,v) => { VehicleAngularDamping = v; } ),
new ParameterDefn("VehicleLinearFactor", "Fraction of physical linear changes applied to vehicle (0.0 - 1.0)",
0.2f,
(s,cf,p,v) => { VehicleLinearFactor = cf.GetFloat(p, v); },
(s) => { return VehicleLinearFactor; },
(s,p,l,v) => { VehicleLinearFactor = v; } ),
new ParameterDefn("VehicleAngularFactor", "Fraction of physical angular changes applied to vehicle (0.0 - 1.0)",
0.2f,
(s,cf,p,v) => { VehicleAngularFactor = cf.GetFloat(p, v); },
(s) => { return VehicleAngularFactor; },
(s,p,l,v) => { VehicleAngularFactor = v; } ),
new ParameterDefn("VehicleFriction", "Friction of vehicle on the ground (0.0 - 1.0)",
0.0f,
(s,cf,p,v) => { VehicleFriction = cf.GetFloat(p, v); },
(s) => { return VehicleFriction; },
(s,p,l,v) => { VehicleFriction = v; } ),
new ParameterDefn("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)",
0.0f,
(s,cf,p,v) => { VehicleRestitution = cf.GetFloat(p, v); },
(s) => { return VehicleRestitution; },
(s,p,l,v) => { VehicleRestitution = v; } ),
new ParameterDefn("VehicleDebuggingEnable", "Turn on/off vehicle debugging",
ConfigurationParameters.numericFalse,
(s,cf,p,v) => { VehicleDebuggingEnabled = BSParam.NumericBool(cf.GetBoolean(p, BSParam.BoolNumeric(v))); },

View File

@ -2,7 +2,6 @@ CURRENT PRIORITIES
=================================================
Deleting a linkset while standing on the root will leave the physical shape of the root behind.
Not sure if it is because standing on it. Done with large prim linksets.
Child movement in linkset (don't rebuild linkset)
Vehicle angular vertical attraction
vehicle angular banking
Center-of-gravity
@ -12,6 +11,7 @@ when should angular and linear motor targets be zeroed? when selected?
Need a vehicle.clear()? Or an 'else' in prestep if not physical.
Teravus llMoveToTarget script debug
Mixing of hover, buoyancy/gravity, moveToTarget, into one force
Setting hover height to zero disables hover even if hover flags are on (from SL wiki)
Nebadon vehicles turning funny in arena
limitMotorUp calibration (more down?)
llRotLookAt
@ -72,7 +72,11 @@ Incorporate inter-relationship of angular corrections. For instance, angularDefl
GENERAL TODO LIST:
=================================================
Avatar standing on a moving object should start to move with the object.
llMoveToTarget objects are not effected by gravity until target is removed.
Compute CCD parameters based on body size
Can solver iterations be changed per body/shape? Can be for constraints but what
about regular vehicles?
Implement llSetPhysicalMaterial.
extend it with Center-of-mass, rolling friction, density
Implement llSetForceAndTorque.
@ -321,4 +325,5 @@ Mantis 6040 script http://opensimulator.org/mantis/view.php?id=6040 (DONE)
Boats float low in the water (DONE)
Boats floating at proper level (DONE)
When is force introduced by SetForce removed? The prestep action could go forever. (DONE)
(Resolution: setForce registers a prestep action which keeps applying the force)
(Resolution: setForce registers a prestep action which keeps applying the force)
Child movement in linkset (don't rebuild linkset) (DONE 20130122))