without script, doesn't limit you to constant degree turns

This commit is contained in:
Sam Gondelman 2015-06-19 16:11:43 -07:00
parent e78ce8055a
commit a0d4b7ec7c
3 changed files with 3 additions and 28 deletions

View file

@ -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;

View file

@ -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

View file

@ -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];