Getting an Array of a Curve3D's points' offsets

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ThEnderYoshi

Hello!
I have a Curve3D belonging to a Path and I want to get an Array of the offsets of the Curve3D’s points. Currently, I am achieving this using this func:

var point_offsets: PoolRealArray

func _get_point_offsets():
    for p in curve.get_point_count():
        var point = curve.get_point_position(p)
        point_offsets.append(curve.get_closest_offset(point))

It works well, but it has a problem when two points have the same position, where the second point will have the same offset as the first.

I also tried adding up the distances to each point, but that yields inaccurate results. (point_offsets[-1] > curve.get_baked_length())