Hi all,
I have an object, in this case a car which moves around the world and I would like the camera do follow the car wherever it goes. I have a function that draws the car at the origin, and a function that draws the camera as if the car is at the origin. Then I in the display func:
glPushMatrix();
state->setCameraLook();
glTranslated(car->getPositionX(), car->getPositionY(), car->getPositionZ());
car->draw();
glPopMatrix();
This way the problem is that in the beginning everything is ok since the car is at the origin. But when I move the car, the car goes away and the camera seems to stay where it is, not moving. If I exchange the lines which set the camera position and the translate, it seems the camera moves itself towars the car and enters in it…
Any ideas?
Best regards,
Paulo Matos