0 votes

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())

Godot version 3.3.2
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.