Jump to content
  • Advertisement
Sign in to follow this  
saravanan_nanothink

Directx Modeller

This topic is 3335 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 all, i am new to this forum, i am developing a modeler in directx, in that i want to establish pick vertices and edges based on the mouse pick, which is already done for pick object, pick faces thru mouse. any help is appreciated, if you can, refer me some code samples in directx. thanks. bye.

Share this post


Link to post
Share on other sites
Advertisement
I don't have any code samples to direct you to. However, there are several methods to pick objects such as vertices and edges, depending on whether you want to pick a single point (where the mouse is clicked) or whether you allow the user to drag a box on the screen to select all vertices within that box.

For vertices and edges, rather than casting rays from the mouse position, do the opposite and project all the points of interest to screen coordinates.

Transform all vertices in the object into screen space (probably using some form of the Project() function) and determine if the screen coordinates of the vertex falls within the drag box, or, for a single mouse point, determine if the screen coordinates of the vertex are within several pixels of the mouse point.

I just use PtInRect() for those tests, creating a RECT around the mouse position for "point" picking.

For edges, the process is similar but much more involved. For every edge, transform the line ends (vertex positions) into screen coordinates, generate the equation for a line from those line-ends, and determine if that line intersects a circle of several pixels around the mouse point. For that algorithm, you can google for "line circle intersection".

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.

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!