Jump to content
  • Advertisement
Sign in to follow this  
neoRAGE

How can i do mouse_over event on a line object i created?

This topic is 5171 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 have a line object that i have created (in vb). I want to find out when the mouse on the screen goes over the line, i want to highlight the line but how can i check that the mouse cursor is over it? Btw the line has 3d coordinates and i have three different view boxes which have: side on view (x-y plane), plan view (x-z plane), and front view (z-y plane).

Share this post


Link to post
Share on other sites
Advertisement
Since a line is infinitely thin, you can't really have the mouse "over" it. However, you can check if it's close (less than 2 pixels away for example). For a 2D line, you'd use the point-to-line distance formula (just Google for it). Since your line is actually a line segment probably, not an infinitely long line, you might want to search for distance from point to line segment. For a 3D line, first project it onto 2D, then check for nearness to the 2D line segment you get.

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!