Number of curve3D baked points and their locations

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

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!

:bust_in_silhouette: Reply From: estebanmolca

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

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

Suleymanov | 2021-03-09 07:28