Files
project-thor/Scripts/person.gd
Nikolai Fesenko b7bf4792f3 navigation agent added for person
now it goes to new object when it is placed . Also new obj model for person
2025-08-15 14:50:15 +02:00

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)