• Advertisement
Sign in to follow this  

Calculating coordinates.

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I'm designing a system map for a space sim game. The obrbital bodies should rotate around the star. And it takes time for the player to travel between orbital bodies.

However i never really worked with sinus and cosinus before and i could use some help.

So in my database i would fetch the distance from the sun and the angle and with that data i should be able to position the body in a X,y coordinate system using sinus and cosinus right?

I tried something like this:

sunX=0
sunY=0

Planet – Distance from sun is 20 angle is 45 degree

Planet X = (cos(45) * 20) + sunX = 10.5
Planet Y = (Sin(45) * 20) + sunY = 17.0

Obviously i'm doing something wrong, as they should both be the same number. and autocad tells me the position of the planet should be roughly X=14.1, Y=14.1.

Also my game will be browser based and i was wondering how heave the load would be to keep calculating the position of each orbital body for each player each couple of minutes.

Share this post


Link to post
Share on other sites
Advertisement
Yeah obviously i just found that here http://groups.google.com/group/irobot-create-forum/web/calculate-x-y-coordinates-with-distance-and-angle-sensor-data :D.

I already tried using gon wich i thought was more logical to use but didn't work.

Anyway thanks i think i can figure it out now.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement