mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Merge pull request #3903 from huffman/gamepad-mirror
Add button to gamepad.js to toggle mirror mode
This commit is contained in:
commit
227f5a498f
1 changed files with 16 additions and 0 deletions
|
@ -18,6 +18,8 @@ var AXIS_ROTATE = Joysticks.AXIS_RIGHT_X;
|
|||
|
||||
var BUTTON_SPRINT = Joysticks.BUTTON_LEFT_STICK;
|
||||
|
||||
var BUTTON_TOGGLE_MIRROR = Joysticks.BUTTON_FACE_LEFT;
|
||||
|
||||
var BUTTON_TURN_AROUND = Joysticks.BUTTON_RIGHT_STICK;
|
||||
|
||||
var BUTTON_FLY_UP = Joysticks.BUTTON_RIGHT_SHOULDER;
|
||||
|
@ -49,6 +51,10 @@ var WARP_PICK_MAX_DISTANCE = 100;
|
|||
var flyDownButtonState = false;
|
||||
var flyUpButtonState = false;
|
||||
|
||||
// When toggling to mirror mode, this stores the mode the user was previously in
|
||||
// so it can be toggled back to.
|
||||
var toggledFromCameraMode = 'first person';
|
||||
|
||||
// Current move direction, axis aligned - that is, looking down and moving forward
|
||||
// will not move you into the ground, but instead will keep you on the horizontal plane.
|
||||
var moveDirection = { x: 0, y: 0, z: 0 };
|
||||
|
@ -179,6 +185,16 @@ function reportButtonValue(button, newValue, oldValue) {
|
|||
}
|
||||
} else if (button == BUTTON_SPRINT) {
|
||||
sprintButtonState = newValue;
|
||||
} else if (button == BUTTON_TOGGLE_MIRROR) {
|
||||
if (newValue) {
|
||||
var currentMode = Camera.mode;
|
||||
if (currentMode == "mirror") {
|
||||
Camera.mode = toggledFromCameraMode;
|
||||
} else {
|
||||
toggledFromCameraMode = currentMode;
|
||||
Camera.mode = "mirror";
|
||||
}
|
||||
}
|
||||
} else if (newValue) {
|
||||
var direction = null;
|
||||
|
||||
|
|
Loading…
Reference in a new issue