mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 11:17:32 +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) {
|
if (active) {
|
||||||
Controller.captureActionEvents();
|
Controller.captureActionEvents();
|
||||||
|
|
||||||
print(yawChange);
|
|
||||||
print(pitchChange);
|
|
||||||
print(JSON.stringify(velocity));
|
|
||||||
|
|
||||||
MyAvatar.bodyYaw = MyAvatar.bodyYaw + yawChange;
|
MyAvatar.bodyYaw = MyAvatar.bodyYaw + yawChange;
|
||||||
MyAvatar.headPitch = Math.max(-180, Math.min(180, MyAvatar.headPitch + pitchChange));
|
MyAvatar.headPitch = Math.max(-180, Math.min(180, MyAvatar.headPitch + pitchChange));
|
||||||
yawChange = 0;
|
yawChange = 0;
|
||||||
|
|
|
@ -76,7 +76,6 @@ const float MyAvatar::ZOOM_DEFAULT = 1.5f;
|
||||||
|
|
||||||
MyAvatar::MyAvatar() :
|
MyAvatar::MyAvatar() :
|
||||||
Avatar(),
|
Avatar(),
|
||||||
_turningKeyPressTime(0.0f),
|
|
||||||
_gravity(0.0f, 0.0f, 0.0f),
|
_gravity(0.0f, 0.0f, 0.0f),
|
||||||
_wasPushing(false),
|
_wasPushing(false),
|
||||||
_isPushing(false),
|
_isPushing(false),
|
||||||
|
@ -1205,28 +1204,9 @@ bool MyAvatar::shouldRenderHead(const RenderArgs* renderArgs, const glm::vec3& c
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::updateOrientation(float deltaTime) {
|
void MyAvatar::updateOrientation(float deltaTime) {
|
||||||
// Gather rotation information from keyboard
|
// Smoothly rotate body with arrow keys
|
||||||
const float TIME_BETWEEN_HMD_TURNS = 0.5f;
|
_bodyYawDelta -= _driveKeys[ROT_RIGHT] * YAW_SPEED * deltaTime;
|
||||||
const float HMD_TURN_DEGREES = 22.5f;
|
_bodyYawDelta += _driveKeys[ROT_LEFT] * YAW_SPEED * deltaTime;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getHead()->setBasePitch(getHead()->getBasePitch() + (_driveKeys[ROT_UP] - _driveKeys[ROT_DOWN]) * PITCH_SPEED * deltaTime);
|
getHead()->setBasePitch(getHead()->getBasePitch() + (_driveKeys[ROT_UP] - _driveKeys[ROT_DOWN]) * PITCH_SPEED * deltaTime);
|
||||||
|
|
||||||
// update body orientation by movement inputs
|
// update body orientation by movement inputs
|
||||||
|
|
|
@ -210,7 +210,6 @@ private:
|
||||||
virtual void setFaceModelURL(const QUrl& faceModelURL);
|
virtual void setFaceModelURL(const QUrl& faceModelURL);
|
||||||
virtual void setSkeletonModelURL(const QUrl& skeletonModelURL);
|
virtual void setSkeletonModelURL(const QUrl& skeletonModelURL);
|
||||||
|
|
||||||
float _turningKeyPressTime;
|
|
||||||
glm::vec3 _gravity;
|
glm::vec3 _gravity;
|
||||||
|
|
||||||
float _driveKeys[MAX_DRIVE_KEYS];
|
float _driveKeys[MAX_DRIVE_KEYS];
|
||||||
|
|
Loading…
Reference in a new issue