🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Coordinate Systems

Started by
2 comments, last by Ozz 23 years, 12 months ago
I have a rather nice environment coded for my boat racing project, my problem is that I need to know exactly where each boat is during the race on the race coarse (open ocean), what direction it is pointed and where each buoy on the coarse is. I am wondering about setting up the coordinate system, does anyone have ideas?
Advertisement
I would say to use arrays. Let''s say this is your track.
/ /
/ /
/ /
/ /
/ /
setup an 2D array
int array[5][3];
use the elements in the array as coordinates
(0,0),(0,1),(0,2)
(1,0),(1,1),(1,2)
(2,0),(2,1),(2,2)
(3,0),(3,1),(3,2)
(4,0),(4,1),(4,2)

then in your boat object let''s say:
typedef struct Position
{
int x;
int y;
};
class Boat
{
private:
Position CurrentPosition;
public:
GetPosition();
};
Boat::GetPosition()
{
return (CurrentPosition);
}

Thanks for the input. What about scaling of the coordinate points, I really need an exact location, i.e what if the boat is in between two coords.
Use floats?
----------------------------------------"Inash neteia haeg joa kavari quilm..." SD4

This topic is closed to new replies.

Advertisement