I have a Path3D in the scene, as well as a PathFollow3D inside it
in GDScript, I change the Progress Ratio to a random value from 0 to 1 (I choose a random point on the path)
Then, I IMMEDIATELY try to get the global coordinate of a randomly selected point
the problem is that the returned coordinate is taken from the OLD Progress Ratio value.
I managed to fix it by just waiting a bit before getting the global coordinate, but I have doubts if I’m doing everything right.
How can this case be explained?
The code looks something like this:
func create_node3D():
# first, I choose a random point on the path
MyPathFollow.progress_ratio = randf_range(0.0, 1.0)
# here, MyPathFollow.global_position returns an incorrect position
MyAnyNode3D.position = MyPathFollow.global_position