View Full Version : camera rotation
02-25-2001, 12:34 PM
Could you help me? I got a camera and I want to rotate it around a point(model) with radius, which I want. Help me, please!
And one more do you know where I can find any car physics tutorial or demos!
02-25-2001, 07:53 PM
glTranslatef(mx,my,mz);//translate to the center of model
glTranslatef(0,0,r);//translate on a radius in direction, orthogonal to rotation axis
Hope this works.
02-25-2001, 10:09 PM
I am not sure whether the code above works or not, but it should be as simple as translate radius out from the origin, rotate by a clock variable, then translate by the central position of the model, leaving the camera radius away, rotated around the model.
Be careful to implement your camera correctly, by making inverse motion changes to the modelview matrix to give the impression a camera. You may want to use an external matrix class to model the motion, then pass it into OpenGL using glLoadMatrix(), this will be much faster than using opengl as a mathlib, and easier to work with.
If you can get your hands on a high school physics book, you should be able to get the kinematics out of it.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.