Set Player rotation

This commit is contained in:
Fabien Freling 2019-03-17 11:38:16 +01:00
parent c0d25d29ba
commit 823846cfd1

View file

@ -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()