GLUT: Player Movement
Hello. I'm working in C (stuck here since it's a project) and I'd like to know how to do keyboard and mouse motion of an avatar. I've been searching and searching but I cannot find any good tutorials specifically addressing this issue.
I've done this time and again in Flash (AS2 and 3) but this is a whole different monster. Any help would be greatly appreciated.
Thanks.
Yeah, that doesn't tell you how to make a function to move the player. I've succeeded in making a basic function that works though. I already knew how to receive input from the keyboard.
Thanks anyway.
Thanks anyway.
Quote:Original post by ViolentAJ
Yeah, that doesn't tell you how to make a function to move the player. I've succeeded in making a basic function that works though. I already knew how to receive input from the keyboard.
Thanks anyway.
Create three variables for the player's position (x, y & z), then increment/decrement them when the correct key is pressed. When you redraw the scene, just use glTranslate(x, y, z) before drawing the player. You may want to encapsulate that with glPushMatrix() and glPopMatrix(). That's all there is to movement.
Does that answer your question? I'm not sure I understood your question in the first place, so tell me if I've misinterpreted.
I think the player movement is all up to you. It's not that hard, I assume you know some trigonometrics (the most basic)
The implementation depends on your needs, for example you want acceleration, strafe etc. Don't wait for us to send code, it wont work for you (for example you are looking in 'x' instead of 'y' or the opposite direction)
this forum for example
googled first person movement glut, 6th hit: this
The implementation depends on your needs, for example you want acceleration, strafe etc. Don't wait for us to send code, it wont work for you (for example you are looking in 'x' instead of 'y' or the opposite direction)
this forum for example
googled first person movement glut, 6th hit: this
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement