- Home /
Dealing with coordinates on a spherical level
I'm trying to make a game that takes place on a small spherical stage but I'm having trouble figuring out how to go about the coordinates (polar/cartesian).
The game is from an isometric perspective with the camera following the character, and I need to know how I can move the character in specific up/down/left/right direction no matter the position on the sphere.
Here's a crude drawing of what I'm trying to achieve
I've been playing around with modifying the coordinates using both Cartesian and polar coordinates but I haven't' been able to figure it out. What's the best way to go about achieving this?
Answer by Fattie · Aug 03, 2012 at 03:59 PM
Fortunately the answer is very simple - it's the very raison d'etre of game engines!
Your character should be inside an "empty game object" called say MY HAPPY PLANE.
Now from the point of view of the game object, you need only locally rotate it or move it, and it does that IN TERMS OF MYHAPPYPLANE.
However, you can indpendently move "MYHAPPYPLANE" anywhere you want!
I was just doing a righ with a huge amount of confusing spinning around motion. But for the "character itself" it came down to nothing more than "moving in and out".
Imagine - oh - the piston in the engine of a car. it only moves "in and out". but if the car itself is tumbling, turning corners etc, the motino (in real ultimate space) is incredibly complex. however you only need to have "in and out" if you're a piston.
this is exactly what game engines do!!
So you're all set!
"never do trigonometry in a game engine, just use another empty object in-between for the concept"
Answer by ScroodgeM · Aug 03, 2012 at 08:12 AM
solution 1
store user's position in direction-like Vector3. on moving just rotate this vector around axis you needsolution 2
looks funny but easy to implement 8) rotate whole world and keep player in one position 8)Your answer
Follow this Question
Related Questions
How to use spherical coordinates in unity? 0 Answers
Map Google lat lng coordinates to sphere 1 Answer
Equirectangular Projection of Sphere onto Texture 2 Answers
Sphere texture bug 0 Answers
DAY and NIGHT Texture on Planet Earth 0 Answers