C++ to use Mopath and MopathInterval

Hi guys,

I have an egg file that has motion path inside
and I can make a .py script to load the model and play the motion path

Is there any way to use the Mopath and MopathInterval library in C++?
Is there any port of these lib in C++?


You’ll have to reimplement Mopath and MopathInterval in C++, but fortunately these are almost trivially simple. The actual implementation of the nurbs evaluation is already handled for you by the ParametricCurve class.

Examine the Python code for Mopath.py and MopathInterval.py. Mopath has a lot of stuff you’re probably not using; just look at the handling for xyzNurbsCurve, which is probably the only curve you’ve got. All it does is search the egg file you give it for a ParametricCurve and store it in xyzNurbsCurve, and then it calls xyzNurbsCurve.getPoint() in goto().

Now look at MopathInterval; all it does is call mopath.goto() at every step.

So, all you need to do is load an egg file, find the ParametricCurve within it, and call get_point() every frame. You can implement this as an Interval, following the MopathInterval model; or you can step outside the interval system and just call it directly, depending on your precise needs.


As always, thank David

I’ll give it a try next week

Nice weekend!