What we want to do is have a model rotate as it moves within it's 3d world.
I can rotate the model (in this case a simple cube) using the rotate method
(eg; theModel.rotate(0,1,0) - this works fine within an exitframe handler, however
if I add the translate method (eg; theModel.translate(0,0,1)) then the model moves
on the y axis as well and doesn't 'move' as one would expect from the script
(it actually jumps all over the place).
If I run the translate method alone (without the rotate method) it's Ok - each
method works fine in isolation but trying to run them together is trouble...
Is there a better way to do this?
It sounds is if you want to move an object in space and rotate it around itself at the same time, like a wheel rolling. Is that right?
If so, the two movements are in two different frames of reference. The translation is relative to the world, the rotation is relative to the central axis of the object. You will need to perform two distinct operations. Something like this:
myModel.rotate(0, yAngle, 0, #self)
myModel.translate(xTranslation, 0, zTranslation, #world)
Is this what you are looking for?
Yes, that's fixed it - thank-you for that!
Would you recommend placing the method/s into the
sprite behaviour (in an exitframe handler) or into a frame
script - will it make any difference?