Godot Version
4.1.1
Question
Im trying to have ai animals follow eachother using get_node().position and get_node().global_position, but when they only move to the starting position of these animals, what should i do to get the current position
4.1.1
Im trying to have ai animals follow eachother using get_node().position and get_node().global_position, but when they only move to the starting position of these animals, what should i do to get the current position
Show the code that makes them move or it’s gonna be hard to help you.
if TWolf == 1:
targetWolf = get_node(“…/…/Wolf”).global_position
accelerate_to_point(targetWolf, ACCELERATION * delta)
if TWolf == 2:
targetWolf = get_node(“…/…/Wolf2”).global_position
accelerate_to_point(targetWolf, ACCELERATION * delta)
and
func accelerate_to_point(point, acceleration_scalar):
var direction = (point - global_position).normalized()
var acceleration_vector = direction * acceleration_scalar
accelerate(acceleration_vector)
Please, post the entirety of the script. Use ``` lines to delimit code in this forum too, so it is syntax-highlighted.