Set Player rotation
This commit is contained in:
parent
c0d25d29ba
commit
823846cfd1
|
@ -20,12 +20,16 @@ func _physics_process(delta):
|
||||||
|
|
||||||
if Input.is_action_pressed("ui_up"):
|
if Input.is_action_pressed("ui_up"):
|
||||||
direction += Vector3(0, 0, -1)
|
direction += Vector3(0, 0, -1)
|
||||||
|
set_rotation_degrees(Vector3(0, 180, 0))
|
||||||
if Input.is_action_pressed("ui_down"):
|
if Input.is_action_pressed("ui_down"):
|
||||||
direction += Vector3(0, 0, 1)
|
direction += Vector3(0, 0, 1)
|
||||||
|
set_rotation_degrees(Vector3(0, 0, 0))
|
||||||
if Input.is_action_pressed("ui_left"):
|
if Input.is_action_pressed("ui_left"):
|
||||||
direction += Vector3(-1, 0, 0)
|
direction += Vector3(-1, 0, 0)
|
||||||
|
set_rotation_degrees(Vector3(0, -90, 0))
|
||||||
if Input.is_action_pressed("ui_right"):
|
if Input.is_action_pressed("ui_right"):
|
||||||
direction += Vector3(1, 0, 0)
|
direction += Vector3(1, 0, 0)
|
||||||
|
set_rotation_degrees(Vector3(0, 90, 0))
|
||||||
|
|
||||||
direction.y = 0
|
direction.y = 0
|
||||||
direction = direction.normalized()
|
direction = direction.normalized()
|
||||||
|
|
Loading…
Reference in a new issue