0
\$\begingroup\$

I want to create a 3 dimensional car game. But i have a problem in moving a car in other directions and accelerating.

I have a car model and a road model placed appropriately. To move car forward, I translate the road model to negative X-axis so my car looks like it moving forward in my case as my car and road track is along the positive X-axis. Now, in the middle I want to turn left or right and for that I rotate the road model, (let's 90 degree). When I do that the car should move away from the road in sideways direction (or, we can say road to be moved), but it does not. As road was being translated to negative x-axis, after rotating the road I thought to be translated along negative x-axis relative the camera but I think the X-axis of the road object is fixed. So what should I do to solve it?

I just want to move a car which can go forward and when it turns left or right it should move forward accordingly.

P.S. I know, my question may not be clear but that's all I could elaborate it. Anyone can notify me if it's not clear and I will try again to clarify my question again.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Note that OpenGL has nothing to do with the car movement. It is just a rendering API - it draws things. \$\endgroup\$
    – Kromster
    Feb 10, 2015 at 5:28
  • \$\begingroup\$ yes. I am using GLFW with glm library to do it \$\endgroup\$
    – Sagaryal
    Feb 10, 2015 at 14:03

1 Answer 1

1
\$\begingroup\$

You should be moving the car positive X axis instead of the environment around the car negative X axis. Then move the camera with the car.

\$\endgroup\$
2
  • \$\begingroup\$ But, I thought we should move the environment rather than the car itself and it might be tedious to move camera and the car both. \$\endgroup\$
    – Sagaryal
    Feb 10, 2015 at 3:35
  • \$\begingroup\$ @Sagaryal: Of all, this is the least trouble. It is going to get A HUGELY LOT more "tedious" once you think of all the other things you need to move to make a game ;-) \$\endgroup\$
    – Kromster
    Feb 10, 2015 at 5:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .