4
$\begingroup$

I'm trying to export Blender Bezier Paths to Unity, so that Unity objects can follow along those paths.

The 2 ways to do this that I came up with so far are:

  1. Blender script creates an empty for every control point in the Blender path, then those get imported into Unity as empty game objects (aka transforms) and from within Unity I can calculate B(t) based on the control points.

  2. Blender script takes a "resolution" parameter, which it uses to evaluate the path and instead create an empty along the path for each sample. Then those get imported into Unity as empties and from within Unity I just have the objects follow this checkpoints along the path.

For approach 2, I'd need to evaluate the spline inside blender. And I was hoping that bpy.types.Curve would have an eval(t) or similar method but I haven't found anything in the API so far.

So my question is, is there anything in the Blender API for evaluating or do I need to write the evaluation code myself?

$\endgroup$
3
$\begingroup$

Ok I found it: mathutils.geometry.interpolate_bezier().

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.