PDA

View Full Version : Creating a moving car



rookie
03-27-2011, 08:58 AM
Hey, im new here so sorry if i missed some old post or something, it tried looking it up but couldn't find anything that was of any help.

Basically what i have a is a Box (just a test box, later will model the actual car) and i need to move it in the x,y plane.

Basically what i did was:

glRotatef(angle, axis_x, axis_y, axis_z);
glTranslatef(_position[0],_position[1],0);
micro_car_draw(_size);

_position is a vector with the x,y values stored in the first and second position respectivelly and the car is suposed to move around the z axis, placed in the back of the Box (where the back wheels are going to be placed).

The thing is, i can only either move the car along the world x axis while rotating on itself, or to move the car along its its own x axis but centered on the world origin instead.

Any input will be apreciated, thanks.

McLeary
03-28-2011, 09:42 AM
It's all about how you are updating the axis and position values. Can you tell a little bit about how you're doing this?