Jump to content
  • Advertisement
Sign in to follow this  
utkarshseth

Selecting lines with a mouse

This topic is 3921 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 several lines on the screen. My motive is to select any line with my mouse and move it around space. Before drawing any frame on the screen i calculate the distance of the mouse coordinates from each line. The gmtl library does this for me. If the line lies in the selection region defined by me i calculate its matrix and draw it on the screen. Now i am able to move any line any where on the screen. But the problem comes here. When i go to select the line again after moving it to some other place on the screen, i ab unable to select the line. The weird thing is that when i move the mouse near the original position of the line (where it was when the program started) i am able to select the line. No matter how far the line is from its original point. That means that the function still keeps in account the original coordinates of the line even if i have moved it to some other place. gmtl::distance calculates the distance between a line segment( which has an origin and a direction) and a point. I was wondering how to solve this problem. Hope you guys could help. Thanks Utkarsh

Share this post


Link to post
Share on other sites
Advertisement
did you consider opengl build-in picking method using names?
or on your own, you need to find ray pointing from cam position through cursor(probably using gluUnproject?) and find the closest distance between this ray and line you're picking, but this is a mathematical issue...

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!