• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

# Velocity/heading. Cartesian or spherical coordinates?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1bobbias  Members

Posted 15 May 2012 - 06:57 AM

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?

### #2Slavik81  Members

Posted 15 May 2012 - 12:47 PM

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.

### #3codeToad  Members

Posted 15 May 2012 - 05:06 PM

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

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.