- Edited
When I print out the get_next_location() it seems to reference the agent node rather than the PatrolPath1 node which is just a standard 3D node. I do have the documentation on hand and have been reading through it, seems straightforward but I haven't been able to make anything happen yet with movement for some odd reason. I think I'm not setting the movementTarget variable correctly but at the same time I've got that next location problem.
https://docs.godotengine.org/en/latest/tutorials/navigation/navigation_using_navigationagents.html
var speed = 10
var movementDelta
func _ready():
SetMovementTarget(patrolPath1.global_transform.origin)
func SetMovementTarget (movementTarget):
navigationAgent.set_target_location(movementTarget)
func _physics_process(delta):
movementDelta = speed * delta
var currentLocation = global_transform.origin
var nextLocation = navigationAgent.get_next_location()
var customVelocity = (nextLocation - currentLocation).normalized() * movementDelta
navigationAgent.set_velocity(customVelocity)
func _on_navigation_agent_3d_velocity_computed(safe_velocity):
velocity = safe_velocity
move_and_slide()