# Velocity/heading. Cartesian or spherical coordinates?

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

## Recommended Posts

I'm working on a game in Java using lwjgl for opengl. I'm working on designing my general "model" representation and I'm stuck trying to decide how I want to represent the heading/velocity of a model. Opengl uses Cartesian coordinates, but I' wondering if there's any reason I should store the model information natively as spherical coordinates... I can't figure out the pros and cons to it.

So I guess what I'm asking is, how does everyone else store the heading/velocity data for your models and why do you store it that way?

##### Share on other sites
That depends on how you acquire the data and what you're going to use it for. Whatever the case, the velocity will need to be adjusted each time the position changes (assuming you're travelling around a sphere). What sort of game is it?

It's much harder to do things like line-of-sight or shortest path checks with spherical coordinates. The poles in particular are very annoying.

##### Share on other sites
Does openGL provide methods for obtaining matrices that perform rotation, translation, and scaling? If so, they are going to have cartesian coordinates as their input/output. Even if you are making your own methods to do these things, it should be easy to google the mathematics necessary to do so. I don't know if it's even possible to perform transformations on spherical coordinates using matrix multiplication. (If it is, it'd be an interesting math lesson [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] ).

##### Share on other sites

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