From 55330cf14fe64ddb5956c70315781303c6d1b22b Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Tue, 30 Apr 2013 13:49:42 -0700 Subject: [PATCH] Merge repairs. --- interface/src/Avatar.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 7ddc988b2d..11026ab1b9 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -111,8 +111,6 @@ Avatar::Avatar(bool isMine) { _head.noise = 0; _movedHandOffset = glm::vec3( 0.0, 0.0, 0.0 ); _usingBodySprings = true; - _springForce = 6.0f; - _springVelocityDecay = 16.0f; _renderYaw = 0.0; _renderPitch = 0.0; _sphere = NULL; @@ -161,8 +159,6 @@ Avatar::Avatar(const Avatar &otherAvatar) { _TEST_bigSpherePosition = otherAvatar._TEST_bigSpherePosition; _movedHandOffset = otherAvatar._movedHandOffset; _usingBodySprings = otherAvatar._usingBodySprings; - _springForce = otherAvatar._springForce; - _springVelocityDecay = otherAvatar._springVelocityDecay; _orientation.set( otherAvatar._orientation ); _sphere = NULL; @@ -427,8 +423,23 @@ void Avatar::simulate(float deltaTime) { // update head information updateHead(deltaTime); - - // Decay head back to center if turned on + // calculate speed, and use that to determine walking vs. standing + _speed = glm::length( _velocity ); + float rotationalSpeed = fabs( _bodyYawDelta ); + + if ( _speed + rotationalSpeed > 0.2 ) { + _mode = AVATAR_MODE_WALKING; + } else { + _mode = AVATAR_MODE_INTERACTING; + } +} + + + + +void Avatar::updateHead(float deltaTime) { + + // Decay head back to center if turned on if (_returnHeadToCenter) { // Decay back toward center _headPitch *= (1.0f - DECAY * 2 * deltaTime);