I’ve finally done some texturing of the ball in my game Hyper Blazer (http://www.gagaplay.com/hypblazer/hypblazer.jnlp but then of course it has to rotate according to movement:
It has to rotate forwards according to your speed, and left-right according to steering.
So what I did is this, which I already feared wouldn’t do what I want:
GL11.glPushMatrix();
GL11.glTranslatef(0, y + DIAMETER, -3); // translate to pos of the ball
GL11.glRotatef(zRot, 1, 0, 0); // forward rotation
GL11.glRotatef(xRot, 0, 0, 1); // left-right rotation
drawBall();
GL11.glPopMatrix();
Obviously, the left-right rotation doesn’t do what I want because the orientation has been changed by the previous (forward) rotation.
The thing is, It’s probably something trivial but I can’t wrap my head around how the rotation should be done. I’ve googled for it, but what came up is some hefty matrix math that’s waaaay above my head. :-[
Any ideas?