Hi I am making a program where I have a football which I have to hit against a wall with 3 hoops each of them have a points depending on which one i hit.
the problem im having is I seems to cannot get the ball to translate towards the z axis in order to reach the wall using glutKeyFunc.
The user controls the game with arrow keys.
left key - to aim the ball left
right key - to aim the ball right
up key - to aim the ball up
down key - to aim the ball down
z key – to shoot the ball against the wall.
The aim of the game is to hit a hoop and score the points
shown inside the hoop.
Once all the hoops are hit the game ends.
Please can you help me as I am really confused what to do here, i have tried a method but it seems to not have worked.
It’s not really clear on what your problem is. Read up on MODELING and VIEWING transforms in the OpenGL Programming Guide (or elsewhere). What you’re describing specifically is a MODELING transform.
Hi I am making a game which I have a to kick a football against a wall which contains 3 hoops with different scores in them, depending on hoop the ball hits the score will differ. e.g. 3, 4, and 5 points.
My problem here is I cannot translate the ball towards the z axis in orde to hit the wall.
In order to translate the user uses glutKeyboardFunc
You didn’t clarify anything. You just restated it, almost verbatim.
“I cannot” doesn’t tell us anything about “why” you cannot. Do you have a computer with a GPU? Do you know how to program? Have you read anything about OpenGL? What have you tried? Let’s see some code. Have you read up on how MODELING and VIEWING transforms work? Have you figured out which API calls you need to make to set those properly? Are you getting an error? What exactly are you getting? etc…
OK forget what I said above I think I pretty much solved it now.
Now heres a problem im having with collision detection.
I want to be able to use collision detection in order to detect if the ball hits the wall (GL_QUADS) if it does I want it to return back to its original position. The ball travels towards the Z axis in order to get to the wall using glTranslate();
I have supplied the code for the ball, ball position and wall below: