Improved joystick support for camera (not perfect yet)
This commit is contained in:
parent
d5c67fabbf
commit
6a215c7ced
1 changed files with 15 additions and 14 deletions
|
@ -48,20 +48,21 @@ func _unhandled_input(event):
|
||||||
neck.rotate_y(-event.relative.x * mousesense)
|
neck.rotate_y(-event.relative.x * mousesense)
|
||||||
camera.rotate_x(-event.relative.y * mousesense)
|
camera.rotate_x(-event.relative.y * mousesense)
|
||||||
## FOR CONTROLLERS
|
## FOR CONTROLLERS
|
||||||
var cam_dir = Input.is_action_pressed("cam_left") or Input.is_action_pressed("cam_right") or Input.is_action_pressed("cam_up") or Input.is_action_pressed("cam_down")
|
if event is InputEventJoypadMotion:
|
||||||
if cam_dir:
|
var cam_dir = Input.is_action_pressed("cam_left") or Input.is_action_pressed("cam_right") or Input.is_action_pressed("cam_up") or Input.is_action_pressed("cam_down")
|
||||||
var x = -event.relative.x * mousesense
|
if cam_dir:
|
||||||
var y = -event.relative.y * mousesense
|
var x = -event.get_axis_value() * mousesense
|
||||||
if Input.is_action_pressed("cam_left"):
|
var y = -event.get_axis_value() * mousesense
|
||||||
x -= 1 * mousesense
|
if Input.is_action_pressed("cam_left"):
|
||||||
if Input.is_action_pressed("cam_right"):
|
x += 1 * mousesense
|
||||||
x += 1 * mousesense
|
if Input.is_action_pressed("cam_right"):
|
||||||
if Input.is_action_pressed("cam_up"):
|
x -= 1 * mousesense
|
||||||
y -= 1 * mousesense
|
if Input.is_action_pressed("cam_up"):
|
||||||
if Input.is_action_pressed("cam_down"):
|
y += 1 * mousesense
|
||||||
y += 1 * mousesense
|
if Input.is_action_pressed("cam_down"):
|
||||||
neck.rotate_y(x)
|
y -= 1 * mousesense
|
||||||
camera.rotate_x(y)
|
neck.rotate_y(x)
|
||||||
|
camera.rotate_x(y)
|
||||||
##################
|
##################
|
||||||
|
|
||||||
# Clamps the camera
|
# Clamps the camera
|
||||||
|
|
Loading…
Reference in a new issue