Sign in to follow this  
vivendi

calc campos

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this