Browse Source

Set Player rotation

master
Fabien Freling 3 years ago
parent
commit
823846cfd1
  1. 4
      scenes/Player.gd

4
scenes/Player.gd

@ -20,12 +20,16 @@ func _physics_process(delta):
if Input.is_action_pressed("ui_up"):
direction += Vector3(0, 0, -1)
set_rotation_degrees(Vector3(0, 180, 0))
if Input.is_action_pressed("ui_down"):
direction += Vector3(0, 0, 1)
set_rotation_degrees(Vector3(0, 0, 0))
if Input.is_action_pressed("ui_left"):
direction += Vector3(-1, 0, 0)
set_rotation_degrees(Vector3(0, -90, 0))
if Input.is_action_pressed("ui_right"):
direction += Vector3(1, 0, 0)
set_rotation_degrees(Vector3(0, 90, 0))
direction.y = 0
direction = direction.normalized()

Loading…
Cancel
Save