From e9aff0a91d6a4d02498ce45759389bb09b34fcbc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 28 Jan 2013 15:11:50 -0800 Subject: BulletSim: do not zero an avatar's standing velocity if it is standing on a moving object. Rearrange pre/post action subscription code to put more in locks. Add meshmerizer params to BulletSimTestUtil scene creation (and fix line endings). Rebuilt version of DLLs and SOs with cleaned up code and no profiling for sure. --- OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 7603254..3884a5d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -56,7 +56,6 @@ public sealed class BSCharacter : BSPhysObject private int _physicsActorType; private bool _isPhysical; private bool _flying; - private bool _wasWalking; // 'true' if the avatar was walking/moving last frame private bool _setAlwaysRun; private bool _throttleUpdates; private bool _floatOnWater; @@ -84,7 +83,6 @@ public sealed class BSCharacter : BSPhysObject _position = pos; _flying = isFlying; - _wasWalking = true; // causes first step to initialize standing _orientation = OMV.Quaternion.Identity; _velocity = OMV.Vector3.Zero; _buoyancy = ComputeBuoyancyFromFlying(isFlying); @@ -220,7 +218,13 @@ public sealed class BSCharacter : BSPhysObject { // The avatar shouldn't be moving _velocityMotor.Zero(); - ZeroMotion(true /* inTaintTime */); + + // If we are colliding with a stationary object, presume we're standing and don't move around + if (!ColliderIsMoving) + { + DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", LocalID); + ZeroMotion(true /* inTaintTime */); + } // Standing has more friction on the ground if (_currentFriction != BSParam.AvatarStandingFriction) @@ -229,8 +233,6 @@ public sealed class BSCharacter : BSPhysObject PhysicsScene.PE.SetFriction(PhysBody, _currentFriction); } DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1}", LocalID, _velocityMotor.TargetValue); - - _wasWalking = false; } else { @@ -260,7 +262,6 @@ public sealed class BSCharacter : BSPhysObject DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", LocalID, stepVelocity, _velocity, Mass, moveForce); PhysicsScene.PE.ApplyCentralImpulse(PhysBody, moveForce); - _wasWalking = true; } }); } -- cgit v1.1