Restore gamepad aim

This commit is contained in:
Nathan Lovato 2019-10-09 09:44:40 +02:00
parent 13f090df51
commit e2380b2d68
2 changed files with 6 additions and 2 deletions

View file

@ -38,7 +38,11 @@ func can_hook() -> bool:
func get_aim_direction() -> Vector2:
var direction: = Vector2.ZERO
direction = (get_global_mouse_position() - global_position).normalized()
match Settings.controls:
Settings.GAMEPAD:
direction = Utils.get_aim_joystick_direction()
Settings.KBD_MOUSE, _:
direction = (get_global_mouse_position() - global_position).normalized()
return direction

View file

@ -9,7 +9,7 @@ func unhandled_input(event: InputEvent) -> void:
func physics_process(delta: float) -> void:
var cast: Vector2 = owner.get_aim_direction() * owner.ray_cast.cast_to.length()
var cast: Vector2 = owner.get_aim_direction() * owner._radius
var angle: = cast.angle()
owner.ray_cast.cast_to = cast
owner.arrow.rotation = angle