15 lines
427 B
GDScript
15 lines
427 B
GDScript
extends KinematicBody
|
|
|
|
const SPEED = 3.0
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
func _physics_process(delta):
|
|
var input = Vector3(Input.get_axis("left", "right"), 0.0, Input.get_axis("up", "down"))
|
|
var motion = Plane.PLANE_XZ.project(get_viewport().get_camera().global_transform.basis.xform(input)).normalized() * SPEED
|
|
|
|
move_and_slide(motion)
|