From a0d4b7ec7c918066beb0ae70097640162c244705 Mon Sep 17 00:00:00 2001 From: Sam Gondelman Date: Fri, 19 Jun 2015 16:11:43 -0700 Subject: [PATCH] without script, doesn't limit you to constant degree turns --- examples/hmdControls.js | 4 ---- interface/src/avatar/MyAvatar.cpp | 26 +++----------------------- interface/src/avatar/MyAvatar.h | 1 - 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/examples/hmdControls.js b/examples/hmdControls.js index 9efcbc9db9..e14ddca3ef 100644 --- a/examples/hmdControls.js +++ b/examples/hmdControls.js @@ -197,10 +197,6 @@ var hmdControls = (function () { if (active) { Controller.captureActionEvents(); - print(yawChange); - print(pitchChange); - print(JSON.stringify(velocity)); - MyAvatar.bodyYaw = MyAvatar.bodyYaw + yawChange; MyAvatar.headPitch = Math.max(-180, Math.min(180, MyAvatar.headPitch + pitchChange)); yawChange = 0; diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 586e7a1f56..148d9cc08c 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -76,7 +76,6 @@ const float MyAvatar::ZOOM_DEFAULT = 1.5f; MyAvatar::MyAvatar() : Avatar(), - _turningKeyPressTime(0.0f), _gravity(0.0f, 0.0f, 0.0f), _wasPushing(false), _isPushing(false), @@ -1205,28 +1204,9 @@ bool MyAvatar::shouldRenderHead(const RenderArgs* renderArgs, const glm::vec3& c } void MyAvatar::updateOrientation(float deltaTime) { - // Gather rotation information from keyboard - const float TIME_BETWEEN_HMD_TURNS = 0.5f; - const float HMD_TURN_DEGREES = 22.5f; - if (!qApp->isHMDMode()) { - // Smoothly rotate body with arrow keys if not in HMD - _bodyYawDelta -= _driveKeys[ROT_RIGHT] * YAW_SPEED * deltaTime; - _bodyYawDelta += _driveKeys[ROT_LEFT] * YAW_SPEED * deltaTime; - } else { - // Jump turns if in HMD - if (_driveKeys[ROT_RIGHT] || _driveKeys[ROT_LEFT]) { - if (_turningKeyPressTime == 0.0f) { - setOrientation(getOrientation() * - glm::quat(glm::radians(glm::vec3(0.f, _driveKeys[ROT_LEFT] ? HMD_TURN_DEGREES : -HMD_TURN_DEGREES, 0.0f)))); - } - _turningKeyPressTime += deltaTime; - if (_turningKeyPressTime > TIME_BETWEEN_HMD_TURNS) { - _turningKeyPressTime = 0.0f; - } - } else { - _turningKeyPressTime = 0.0f; - } - } + // Smoothly rotate body with arrow keys + _bodyYawDelta -= _driveKeys[ROT_RIGHT] * YAW_SPEED * deltaTime; + _bodyYawDelta += _driveKeys[ROT_LEFT] * YAW_SPEED * deltaTime; getHead()->setBasePitch(getHead()->getBasePitch() + (_driveKeys[ROT_UP] - _driveKeys[ROT_DOWN]) * PITCH_SPEED * deltaTime); // update body orientation by movement inputs diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 7adaf908f4..c4a9362fef 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -210,7 +210,6 @@ private: virtual void setFaceModelURL(const QUrl& faceModelURL); virtual void setSkeletonModelURL(const QUrl& skeletonModelURL); - float _turningKeyPressTime; glm::vec3 _gravity; float _driveKeys[MAX_DRIVE_KEYS];