mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-16 18:18:19 +02:00
without script, doesn't limit you to constant degree turns
This commit is contained in:
parent
e78ce8055a
commit
a0d4b7ec7c
3 changed files with 3 additions and 28 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue