The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

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 (21 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 Frequently asked questions and 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 [email protected] with your username.