| Lucas Walter
|
10
|
 |
|
01-22-2004 12:28 PM ET (US)
|
|
> I'm trying to rotate the camera about the cue ball in my 3d pool > game. do u have any suggestions on how i update the camera > position for the eye cordinates.. at the monent i'm using theta > = theta - 0.05f; > eyeX = > 0.1f*((float)cos(theta)); > eyeZ = > 10.0f*((float)sin(theta)) + 2.5f;
Up = (0,1,0) & eyeY = 0, correct? But the formula you have seems wrong: Eye is what you are looking at, so that should be the x,y,z of the cue ball, while center is where the camera is. If you were moving the camera along x & z (up and down and left and right on the table) while making eye the cue ball, the camera will move but always be looking straight at the cue ball.
To rotate in a perfect circle around the cue ball, centerX = cueballX -r*cos(theta), centerY = cueballY, centerZ = cueballZ - r*sin(theta), where r is how far the camera should be from the cue ball. Eye =(cueballX,cueballY,cueballZ) Up = (0,1,0).
|