that is my script, the mensage only appear when i execute the game, i´m reallhy new with this.
(sorry if my english is bad)
extends KinematicBody
onready var nav = $"../Navigation" as Navigation
onready var player = $"../player" as KinematicBody
var path = [0]
var current_node = 0
var speed = 2
func _ready():
pass
func physicsprocess(delta):
var direction = Vector3()
update_path(player.global_transform.origin)
if current_node < path.size():
direction = path[current_node] - global_transform.origin
if direction.length() < 1:
current_node += 1
else:
move_and_slide(direction.normalized()* speed)
func updatepath(targetposition):
path = nav.getsimplepath(globaltransform.origin, targetposition)