19 lines
494 B
GDScript
19 lines
494 B
GDScript
extends CharacterBody3D
|
|
|
|
var nav_agent: NavigationAgent3D
|
|
func _ready() -> void:
|
|
nav_agent = $NavigationAgent3D
|
|
Global.object_placed.connect(_on_object_placed)
|
|
|
|
#nav_agent.target_position = Vector3(-15.955,3.486,-58.942)
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
var new_velocity = global_position.direction_to(nav_agent.get_next_path_position()) * 5.0
|
|
velocity = new_velocity
|
|
move_and_slide()
|
|
|
|
|
|
|
|
func _on_object_placed():
|
|
nav_agent.target_position = Vector3(-14.305,3.486,-59.836)
|