Jump to content
  • Advertisement
Sign in to follow this  
lightfoot256

Line of Sight interception with a circle

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

Heya, I'm working on a line-of-sight algorithm that sends out rays from its current position into the world returning a list of the objects that it can see and the distance of the objects from the initial starting point. For now, all the objects will use circles as their collision shape... I've managed to get it to check if an object exists on a given line, but am a little stumped to how to find out how far away that object is... i.e. how far from the point to the exact point on the circle that it colided with. Any help would be much appreciated, thanks! Chris

Share this post


Link to post
Share on other sites
Advertisement
the raytrace should give you a 't' value. that is the disatnce from the start point to the intersection on the circle.

Else a good approximation would be the projected distance of the centre of te circle to the ray, or just the distance of the ray centre to teh start position. That should be accurate enough over long distances (circle radius being small).

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!