How to modify a mopath curve?

I have an actor which needs to follow a complex path. So, I choosed the mopath interval to do the job. However the actor needs to start from a certain location and I would like to scale the path to stretch it.
I’ve seen that I can modify the curve by modifying the parent of the actor, but the actor is also affected.

The file shows that a nurbcurve is used, but is there a way to modify this curve as simply as a node?

Also, but that an optional question, is there a way that the actor rotates itself following the path?


You can modify the mopath, though the interface is a little clumsy. mopath.xyzNurbsCurve contains the details of your curve; try help(mopath.xyzNurbsCurve) to list all the interfaces you can call on this object. In particular, you can use mopath.xyzNurbsCurve.setCvPoint() to move a particular CV or whatever.

You can set mopath.fFaceForward = True to make the object automatically face forward as it travels.


tangential question (because I forget…): does Panda encode an ‘up’ value along a mopath, or is the up vector fixed if you try to point a node along a path, or is up calculated dynamically on the basis of the path direction/tangent? (i.e. is a node/camera barrel-rolling along a path ever an issue, and is it remediable?)

You can also assign mopath.upVectorNodePath, which defines the space of the up vector. If you’re clever, you can rotate this nodePath during the flight of the object to deal with barrel rolls and such; or you can have it controlled by a separate, parallel Mopath.

Another way to deal with this is to use a HPR curve instead of fFaceForward. This is a separate curve that you bind with the Mopath (it can even be loaded automatically from the egg file) that describes the rotation of the object at each point along the curve, in HPR space (instead of XYZ space). Constructing this curve in a common modeling package might be a challenge, though, but you could write a bit of Python code to construct it according to whatever inputs you happen to have.


I am trying to load and change the z-coordinate of a mopath nurbscurve. The nurbscurve is exported from Blender 2.79 using yabee plugin.

I try to set new CvPoints and the coordinates change but the mopath does not change location.

When I change the z-coordinate of the CvPoint in the original files, the curve draws correctly.

please help, any suggestions?

def loadRail(fpath,railname):
            self.myMopath = Mopath.Mopath(name=railname)
            print("num CV points",self.myMopath.xyzNurbsCurve.getNumCvs())
            for i in range(self.myMopath.xyzNurbsCurve.getNumCvs()):

                print(self.myMopath.xyzNurbsCurve.getCvPoint(i)) #see if cvpoint has changed


Example of my nurbscurve file

<CoordinateSystem> { Z-up } 
  <Group> flatrailCurvedNC {
    <Transform> {
      <Matrix4> {
        1.0 0.0 0.0 0.0 
        0.0 1.0 0.0 0.0 
        0.0 0.0 1.0 0.0 
        0.0 0.0 0.0 1.0 
    <VertexPool> flatrailCurvedNC {
      <Vertex> 0 {
        -192.838577 26.330872 26.496584 1.000000
      <Vertex> 1 {
        -180.096085 -22.662350 26.390673 1.000000
      <Vertex> 2 {
        -144.462296 -58.006084 26.468363 1.000000
      <Vertex> 3 {
        -95.092278 -71.061890 26.496584 1.000000
    <NURBSCurve> {
      <Scalar> subdiv { 36 }
      <Order> { 2 }
      <Knots> { 0.00 0.00 0.33 0.67 1.00 1.00 }
      <VertexRef> {
        0 1 2 3
        <Ref> { flatrailCurvedNC } 

Welcome to the community! I hope that you enjoy your time here! :slight_smile:

I haven’t used the MoPath class myself, and have only limited experience of the underlying elements, but do you perhaps have to call “recompute” on the “xyzNurbsCurve” object after altering it?

1 Like

Thank you, Thaumaturge

adding this line solved it:


btw, drwr mentioned to try "help(mopath.xyzNurbsCurve) " to list callable interfaces on object. How to use this help function?


1 Like

Ah, I didn’t know about that “help” function!

But trying it out, it seems simple enough: it’s appears to just be a built-in Python function to which you can pass an object or class in order to get information on that object or class. That is, the line that drwr mentioned is simply a line of code that could be included in your program. It would then print out its results to the console.