BulletSim: make density display and return value consistant with how
the simulator expects it (scaled to 100kg/m^3).TeleportWork
parent
1416c90932
commit
5a7784a0e6
|
@ -75,7 +75,7 @@ public sealed class BSCharacter : BSPhysObject
|
||||||
RawVelocity = OMV.Vector3.Zero;
|
RawVelocity = OMV.Vector3.Zero;
|
||||||
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
|
_buoyancy = ComputeBuoyancyFromFlying(isFlying);
|
||||||
Friction = BSParam.AvatarStandingFriction;
|
Friction = BSParam.AvatarStandingFriction;
|
||||||
Density = BSParam.AvatarDensity / BSParam.DensityScaleFactor;
|
Density = BSParam.AvatarDensity;
|
||||||
|
|
||||||
// Old versions of ScenePresence passed only the height. If width and/or depth are zero,
|
// Old versions of ScenePresence passed only the height. If width and/or depth are zero,
|
||||||
// replace with the default values.
|
// replace with the default values.
|
||||||
|
|
|
@ -463,7 +463,7 @@ public static class BSParam
|
||||||
// Density is passed around as 100kg/m3. This scales that to 1kg/m3.
|
// Density is passed around as 100kg/m3. This scales that to 1kg/m3.
|
||||||
// Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well
|
// Reduce by power of 100 because Bullet doesn't seem to handle objects with large mass very well
|
||||||
new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)",
|
new ParameterDefn<float>("DensityScaleFactor", "Conversion for simulator/viewer density (100kg/m3) to physical density (1kg/m3)",
|
||||||
0.0001f ),
|
0.01f ),
|
||||||
|
|
||||||
new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing",
|
new ParameterDefn<float>("PID_D", "Derivitive factor for motion smoothing",
|
||||||
2200f ),
|
2200f ),
|
||||||
|
@ -474,8 +474,9 @@ public static class BSParam
|
||||||
0.2f,
|
0.2f,
|
||||||
(s) => { return DefaultFriction; },
|
(s) => { return DefaultFriction; },
|
||||||
(s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ),
|
(s,v) => { DefaultFriction = v; s.UnmanagedParams[0].defaultFriction = v; } ),
|
||||||
|
// For historical reasons, the viewer and simulator multiply the density by 100
|
||||||
new ParameterDefn<float>("DefaultDensity", "Density for new objects" ,
|
new ParameterDefn<float>("DefaultDensity", "Density for new objects" ,
|
||||||
10.000006836f, // Aluminum g/cm3
|
1000.0006836f, // Aluminum g/cm3 * 100
|
||||||
(s) => { return DefaultDensity; },
|
(s) => { return DefaultDensity; },
|
||||||
(s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ),
|
(s,v) => { DefaultDensity = v; s.UnmanagedParams[0].defaultDensity = v; } ),
|
||||||
new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" ,
|
new ParameterDefn<float>("DefaultRestitution", "Bouncyness of an object" ,
|
||||||
|
@ -555,8 +556,9 @@ public static class BSParam
|
||||||
0.95f ),
|
0.95f ),
|
||||||
new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run",
|
new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run",
|
||||||
1.3f ),
|
1.3f ),
|
||||||
new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation.",
|
// For historical reasons, density is reported * 100
|
||||||
3.5f) ,
|
new ParameterDefn<float>("AvatarDensity", "Density of an avatar. Changed on avatar recreation. Scaled times 100.",
|
||||||
|
3500f) , // 3.5 * 100
|
||||||
new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
|
new ParameterDefn<float>("AvatarRestitution", "Bouncyness. Changed on avatar recreation.",
|
||||||
0f ),
|
0f ),
|
||||||
new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
|
new ParameterDefn<float>("AvatarCapsuleWidth", "The distance between the sides of the avatar capsule",
|
||||||
|
@ -608,9 +610,8 @@ public static class BSParam
|
||||||
0.0f ),
|
0.0f ),
|
||||||
new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)",
|
new ParameterDefn<float>("VehicleRestitution", "Bouncyness factor for vehicles (0.0 - 1.0)",
|
||||||
0.0f ),
|
0.0f ),
|
||||||
// Turn off fudge with DensityScaleFactor = 0.0001. Value used to be 0.2f;
|
|
||||||
new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)",
|
new ParameterDefn<float>("VehicleGroundGravityFudge", "Factor to multiply gravity if a ground vehicle is probably on the ground (0.0 - 1.0)",
|
||||||
1.0f ),
|
0.2f ),
|
||||||
new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.",
|
new ParameterDefn<float>("VehicleAngularBankingTimescaleFudge", "Factor to multiple angular banking timescale. Tune to increase realism.",
|
||||||
60.0f ),
|
60.0f ),
|
||||||
new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect",
|
new ParameterDefn<bool>("VehicleEnableLinearDeflection", "Turn on/off vehicle linear deflection effect",
|
||||||
|
|
|
@ -187,10 +187,23 @@ public abstract class BSPhysObject : PhysicsActor
|
||||||
MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
|
MaterialAttributes matAttrib = BSMaterials.GetAttributes(Material, false);
|
||||||
Friction = matAttrib.friction;
|
Friction = matAttrib.friction;
|
||||||
Restitution = matAttrib.restitution;
|
Restitution = matAttrib.restitution;
|
||||||
Density = matAttrib.density / BSParam.DensityScaleFactor;
|
Density = matAttrib.density;
|
||||||
// DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density);
|
// DetailLog("{0},{1}.SetMaterial,Mat={2},frict={3},rest={4},den={5}", LocalID, TypeName, Material, Friction, Restitution, Density);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override float Density
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return base.Density;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
DetailLog("{0},BSPhysObject.Density,set,den={1}", LocalID, value);
|
||||||
|
base.Density = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Stop all physical motion.
|
// Stop all physical motion.
|
||||||
public abstract void ZeroMotion(bool inTaintTime);
|
public abstract void ZeroMotion(bool inTaintTime);
|
||||||
public abstract void ZeroAngularMotion(bool inTaintTime);
|
public abstract void ZeroAngularMotion(bool inTaintTime);
|
||||||
|
|
Loading…
Reference in New Issue