0 votes

Currently I am using:

for p in $Path.curve.get_point_count():
    pointPos = $Path.curve.get_point_position(p)

But instead of control points count and their locations, I need baked points count and their locations. I read about get_baked_points() but I don't know how I can count them and get their locations.

I appreciate your time!

Godot version 3.2.3
in Engine by (307 points)

1 Answer

0 votes
Best answer

getbakedpoints () is an array of positions. To count them use the property of arrays: size. I leave you a small example that duplicates a mesh and puts it in each point of the array, that is, the baked points of the curve. If you reduce the bake interval in the path properties you can see how the points increase.

extends Spatial
var points

func _ready():
    points=$Path.curve.get_baked_points()
    print(points.size())

    for i in points:
        var a =$MeshInstance.duplicate()
        add_child(a)
        a.translation = i
by (1,714 points)
selected by

Highly appreciated, Esteban! That worked well. Thank you!

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.