Mopath Question

I’ve been fiddling around with Mopaths and MopathIntervals, and I’ve reached a bit of a problem.

I load in just a Mopath from a file, and create a MopathInterval from it, and it works ok. The position of the object I’m changing with the MopathInterval works, but when I set the fForwardFlag to make it adjust the hpr, I tend to get some spinning at the vertical areas of the Mopath.

Looking at the actual code of the Mopath, I find it uses the lookAt function to follow the angle of the Mopath with the default up vector. I also note that there seems to be code for both a pos curve and a hpr curve.

My inital thought was to add a up vector node path to the class and use that to find an up vector for lookAt to use, since I am not sure how to flag a curve as a pos curve or a hpr curve in maya or the egg itself. It also seems like a hpr curve would look really odd in maya and may be nearly impossible to create and modify upon.

Any thoughts on this?

~~Adam Serdar

One trick you might employ is to create a parallel curve that follows your first curve, and provides the up vector as the delta between corresponding points on your two curves.

Then you could modify the Mopath.goTo() method to do something like this:

self.upNurbsCurve.getPoint(self.playbackTime, self.upPoint)
upVector = self.upPoint - self.posPoint
self.xyzNurbsCurve.getTangent(self.playbackTime, self.tangentVec)
node.lookAt(Point3(self.posPoint + self.tangentVec), upVector)


Sounds like a plan to me.

I’ll give that a try.


~~Adam Serdar