I found how to get points from a spline bezier or poly curve, but how to adapt it for Upbge game object controller ?
from mathutils import geometry
count = 16
ops_mesh = ops.meshCreate curve and randomize its points.
ops.curve.primitive_bezier_curve_add(enter_editmode=True)
ops.transform.vertex_random(offset=1.0, uniform=0.1, normal=0.01, seed=0)
ops.object.mode_set(mode=‘OBJECT’)Acquire a reference to the bezier points.
bez_curve = context.active_object
bez_points = bez_curve.data.splines[0].bezier_pointsGet a list of points distributed along the curve.
points_on_curve = geometry.interpolate_bezier(
bez_points[0].co,
bez_points[0].handle_right,
bez_points[1].handle_left,
bez_points[1].co,
count)Create an empty object to serve as parent to all cubes.
ops.object.empty_add(type=‘PLAIN_AXES’, location=bez_curve.location)
group = context.active_objectCreate cubes.
cube_rad = 0.5 / count
for point in points_on_curve:
ops_mesh.primitive_cube_add(radius=cube_rad, location=point)
cube = context.active_object
cube.parent = group
From
https://medium.com/@behreajj/scripting-curves-in-blender-with-python-c487097efd13