Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

JOGL problem

Name: Anonymous 2010-04-27 16:58

hey i ve got a problem with JOGL(Java + openGL). I have created a hero that the user controls. any ideas how i can make it move to explore an area? till now i have achieved to make him move forward and rotate its body but when it rotates and i press the forward key again it keeps on moving in the same direction as before the rotation but with its body rotated.

Name: Anonymous 2010-04-27 17:32

Ignore OpenGL; that is not the problem, as >>4 said.
Imagine those two functions are something you have written:
rotate_guy( rotation );
move_guy( 0, 1 );

move_guy, as you have written it, does not care about the rotation of the guy. Why should it? Position and rotation are independent of each other.

This is what happens. OpenGL does not care about an object's rotation when moving it. You need to take into account the rotation of the guy, through trigonometry or vectors or otherwise.
move_guy( sin( rotation ), cos( rotation ) );

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List