navigation agent added for person
now it goes to new object when it is placed . Also new obj model for person
This commit is contained in:
18
Scripts/person.gd
Normal file
18
Scripts/person.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user