Jump to content
  • Advertisement
Sign in to follow this  
vivendi

calc campos

This topic is 3328 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

hey, i currently have a basic game setup with a character and a camera behind the character. my goal is to make the cam moveable all around the character, like if there is bowl placed over the char. so basically a 3rd personview, like you see in most MMO games. my question is, what is the formula for this?? i already have the cam placed behind the char, at a certain distance. so i already have the data i need, i just don't know how to calculate what i want. my vars camDistance camPos.x camPos.y camPos.z and if needed charPos.x, y and z could someone please help me out with this...??

Share this post


Link to post
Share on other sites
Advertisement
How do you want to control the position (angle) of the camera relative to the player?

One common choice is to use two angles: a "phi" or "altitude" (angle above the ground: 0 = holding the camera level, 90 degrees = looking straight down), and a "theta" or "azimuth" (angle around the player); and a distance: the radius of the bowl you're imagining.

To convert these angles into a position, you convert from these so-called "spherical" coordinates to "cartesian" (rectangular) coordinats (i.e. the ones with .x/.y/.z values), and then offset by the player's position.

Try these Google results to figure out the conversion and find some diagrams.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!