calc campos

Started by
0 comments, last by Zahlman 14 years, 10 months ago
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...??
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.

This topic is closed to new replies.

Advertisement