• Advertisement
Sign in to follow this  

Camera Rotation

This topic is 4010 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Howdy again folks. I got directx running and the camera functioning and now I'm just trying to make the camera rotate smoother. I starting off doin simple controls like move left, move right, up , down , forward and backward, but I thought most fun controls are in circle rotations. So I remember tthat a point on a circle is given by: Note: I use Z instead of Y because of thinking of top down circle x position = cos(angle) * radius z position = sin(angle) * radius And I used a fixed radius, and it worked surprisingly smooth. Now, I also used a fixed angle, meaning it started at 0, and each "turn" incremeted or decremented by 0.1, and again, it worked very smooth. My problem came from wanting to update the radius as I did other functions such as moving camera forward, backward, left or right (up/down dont affect it since I'm concerning myself with x and z right now). Actually, that part seems right because I do: radius = sqrt((posX - lookX)*(posX - lookX) + (posZ - lookZ)*(posZ - lookZ)); But I realized if I did those other functions (right/left/forward/back) the angle could change, but I didnt change the angle. So now I'm stuck on figuring out how to find the angle in a circle givin the radius and the coordinates of the angle side's interception with the circle. I USED to be so keen at math, but it seems I have forgot some basics (and couldnt find what I was looking for from Google). Any ideas? Thanks

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Crazyfool
So now I'm stuck on figuring out how to find the angle in a circle givin the radius and the coordinates of the angle side's interception with the circle.


atan2 can be used to compute the angle between two points (your centre and your intersection). There's a pretty good article here that gives examples.

Sorry if that was not what you were asking. I wasn't too sure.

Share this post


Link to post
Share on other sites
Thats exactly what, which I actually tried using, but I think I used it wrong, but the way you just described it makes perfect sense. THANKS!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement