mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 04:07:11 +02:00
Add auto-turn of body when head is beyond 45 degrees
This commit is contained in:
parent
c284303031
commit
709a40516d
1 changed files with 15 additions and 0 deletions
|
@ -19,6 +19,7 @@ var warpPosition = { x: 0, y: 0, z: 0 };
|
|||
|
||||
var hipsToEyes;
|
||||
var restoreCountdownTimer;
|
||||
var headTurningTimer = 0.0;
|
||||
|
||||
// Overlays to show target location
|
||||
|
||||
|
@ -168,6 +169,20 @@ function update(deltaTime) {
|
|||
restoreCountDownTimer = 0.0;
|
||||
}
|
||||
}
|
||||
var HEAD_TURN_TIME = 0.10;
|
||||
var HEAD_TURN_DEGREES = 4.0;
|
||||
var HEAD_TURN_START_ANGLE = 45.0;
|
||||
var currentYaw = MyAvatar.getHeadFinalYaw();
|
||||
if (Math.abs(currentYaw) > HEAD_TURN_START_ANGLE) {
|
||||
headTurningTimer += deltaTime;
|
||||
if (headTurningTimer > HEAD_TURN_TIME) {
|
||||
headTurningTimer = 0.0;
|
||||
MyAvatar.orientation = Quat.multiply(Quat.fromPitchYawRollDegrees(0, (currentYaw > 0) ? HEAD_TURN_DEGREES: -HEAD_TURN_DEGREES, 0),
|
||||
MyAvatar.orientation);
|
||||
}
|
||||
} else {
|
||||
headTurningTimer = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
Controller.keyPressEvent.connect(function(event) {
|
||||
|
|
Loading…
Reference in a new issue