How can I find the world location of a random point on a curve?

I want to sample points of a curve along its length, taking the world location of the points as I go. How can I find the world location? I don’t know enough yet about curves, order, etc… obviously. :slight_smile:

You may adjust the resolution of the curve, convert the curve to a mesh, grab the coordinates of the mesh vertices and apply the world matrix of the curve object to them.


mesh=curve.to_mesh(bpy.context.scene,True,'RENDER')

mat=curve.matrix_world
loc_obj_space=[v.co for v in mesh.vertices]
loc_world_space=list(map(lambda x: mat*x, loc_obj_space))

Very clever :slight_smile: I’ll try that, thank you.

This worked perfectly for what I was trying to do, by the way, so thank you again.

This may be cheaper:

mesh = curve.to_mesh(bpy.context.scene,True,'RENDER')
mesh.transform(curve.matrix_world)
loc_world_space = [v.co for v in mesh.vertices]

there’s mathutils.geometry.interpolate_bezier(), a quick test returned odd values with z=0 however :frowning: