Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Getting destination with an angle

This topic is 6144 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

Ive been trying to figure out how to get destination points given a certain angle. I''ve been using sin and cos for amounts moved, but Im having a problem finding edge destinations. For example, I have a ship on the screen, and it is facing at any angle (0-360), how would I check where a line from the ship intersects the edge of the screen? My res. is 1024x768. My brain is fried, any help is appreciated. Thanks- Jeff

Share this post

Link to post
Share on other sites
Solve the equations :

left edge : x = 0
ship : x = x0 + t.cos(a), y = y0 + t.sin(a)

solve for t, that gives you the intersection with the left edge.

Lather, rinse, repeat.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!