From df3759e09998bd05c2a09c79c38ada66fa6ec785 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 13 Oct 2017 12:00:07 -0700 Subject: 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. --- OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs | 14 ++++++++++---- OpenSim/Region/PhysicsModules/BulletS/BSParam.cs | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/PhysicsModules') diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index 7faee70..d182c34 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs @@ -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. diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs index fcda92c..495f752 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs @@ -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("AvatarStandingFriction", "Avatar friction when standing. Changed on avatar recreation.", 0.95f ), + new ParameterDefn("AvatarWalkVelocityFactor", "Speed multiplier if avatar is walking", + 1.0f ), new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", 1.3f ), // For historical reasons, density is reported * 100 -- cgit v1.1