BulletSim: Add parameter "[BulletSim]AvatarWalkVelocityFactor=1.0" to

adjust the walking speed passed from the simulator. Default is 1.0f so
there should be no change for regions who do not change the factor.

The adjustment for walking speed and AlwaysRun speed should be in the
simulator and not the physics engines (who all assume TargetVelocity.set
is only used for avatar walking/running) but that would require tweaking
all the phyiscs engines.
0.9.0.1-postfixes
Robert Adams 2017-10-13 12:00:07 -07:00
parent 59afeb6c4c
commit df3759e099
2 changed files with 13 additions and 4 deletions

View File

@ -460,13 +460,19 @@ public sealed class BSCharacter : BSPhysObject
set
{
DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value);
base.m_targetVelocity = value;
OMV.Vector3 targetVel = value;
if (_setAlwaysRun && !_flying)
targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 1f);
if (!_flying)
{
if (_setAlwaysRun)
targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 1f);
else
if (BSParam.AvatarWalkVelocityFactor != 1f)
targetVel *= new OMV.Vector3(BSParam.AvatarWalkVelocityFactor, BSParam.AvatarWalkVelocityFactor, 1f);
}
base.m_targetVelocity = targetVel;
if (m_moveActor != null)
m_moveActor.SetVelocityAndTarget(RawVelocity, targetVel, false /* inTaintTime */);
m_moveActor.SetVelocityAndTarget(RawVelocity, base.m_targetVelocity, false /* inTaintTime */);
}
}
// Directly setting velocity means this is what the user really wants now.

View File

@ -135,6 +135,7 @@ public static class BSParam
public static bool AvatarToAvatarCollisionsByDefault { get; private set; }
public static float AvatarFriction { get; private set; }
public static float AvatarStandingFriction { get; private set; }
public static float AvatarWalkVelocityFactor { get; private set; }
public static float AvatarAlwaysRunFactor { get; private set; }
public static float AvatarDensity { get; private set; }
public static float AvatarRestitution { get; private set; }
@ -604,6 +605,8 @@ public static class BSParam
0.2f ),
new ParameterDefn<float>("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.",
0.95f ),
new ParameterDefn<float>("AvatarWalkVelocityFactor", "Speed multiplier if avatar is walking",
1.0f ),
new ParameterDefn<float>("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run",
1.3f ),
// For historical reasons, density is reported * 100