I have a scene containing a Path
Node (the red dots with the blue lines)
I want to use the Path Node as a list of ordered checkpoints (easy to add with the editor), for a character, with some kind of obstacle avoidance.
I can get the list of all steps along the Curve3D
, with $Path.get_curve().get_baked_points()
, the distance between two steps being $Path.bake_interval
. But that's not what I need for my purpose. I only want the red dots, not all increment, since some of them are inside the obstacles.
Is there any mean to get a list of the red dots from script ? Or some configuration on Path or Curve3D to force all the increments being the red dots ?
Otherwise, could you suggest an alternative way to add, as easily as that, a list of ordered checkpoints ?
You can get the number of points of the curve with get_point_count
, and then get the position of each one with get_point_position
. For example:
for index in curve.get_point_count():
print(curve.get_point_position(index))
Should print the positions you want.