From 7266eeca6efd10852a062cfc802a50c346b7b119 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 28 Dec 2012 12:01:57 -0800 Subject: BulletSim: add 'AvatarAlwaysRunFactor' parameter and use in setTargetVelocity to implement the 'always run' feature. --- OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 6 +++--- OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 90936d0..901f976 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -464,15 +464,15 @@ public sealed class BSCharacter : BSPhysObject { DetailLog("{0},BSCharacter.setTargetVelocity,call,vel={1}", LocalID, value); OMV.Vector3 targetVel = value; + if (_setAlwaysRun) + targetVel *= BSParam.AvatarAlwaysRunFactor; + PhysicsScene.TaintedObject("BSCharacter.setTargetVelocity", delegate() { _velocityMotor.Reset(); _velocityMotor.SetTarget(targetVel); _velocityMotor.SetCurrent(_velocity); _velocityMotor.Enabled = true; - - // Make sure a property update happens next step so the motor gets incorporated. - BulletSimAPI.PushUpdate2(PhysBody.ptr); }); } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index f8f24bd..5c8553a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -68,6 +68,7 @@ public static class BSParam // Avatar parameters public static float AvatarFriction { get; private set; } public static float AvatarStandingFriction { get; private set; } + public static float AvatarAlwaysRunFactor { get; private set; } public static float AvatarDensity { get; private set; } public static float AvatarRestitution { get; private set; } public static float AvatarCapsuleWidth { get; private set; } @@ -367,6 +368,11 @@ public static class BSParam (s,cf,p,v) => { AvatarStandingFriction = cf.GetFloat(p, v); }, (s) => { return AvatarStandingFriction; }, (s,p,l,v) => { AvatarStandingFriction = v; } ), + new ParameterDefn("AvatarAlwaysRunFactor", "Speed multiplier if avatar is set to always run", + 1.3f, + (s,cf,p,v) => { AvatarAlwaysRunFactor = cf.GetFloat(p, v); }, + (s) => { return AvatarAlwaysRunFactor; }, + (s,p,l,v) => { AvatarAlwaysRunFactor = v; } ), new ParameterDefn("AvatarDensity", "Density of an avatar. Changed on avatar recreation.", 3.5f, (s,cf,p,v) => { AvatarDensity = cf.GetFloat(p, v); }, -- cgit v1.1