Advertisement Jump to content
Sign in to follow this  
Anddos

Dragable picking

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

How do you select more than 1 model at a time with picking,the same idea in rts games where you make a box in 2D i think and it selects the units in 3D,how would i achieve this effect?

Edited by Anddos

Share this post


Link to post
Share on other sites
Advertisement

I think there are 2 ways for this problem. First you use D3DVectorProject to project vertexes of your unit in 3dWorld to ScreenWorld (AaBox for example). Then checking it with your 2d Rect. I think this is very simple, just to optimize the number of Project call, as I know it's not very fast! (<100 is ok, but more is not good)

 

The more common way, is to generate a Frustum with your Rect. This is just like how you pre detect which Mesh is on Screen (The rect here is your Video size). Then checking if your unit/mesh is inside your Frustum! This way is more complex, because you do things in the 3dWorld...

If you want to learn about Frustum Culling this article is very nice : http://www.flipcode.com/archives/Frustum_Culling.shtml

 

In the both approach. You must first have a pre select step, select only mesh/ unit that are potential. So the number of check is short. Although there are case, when all unit stay at some point, and a simple box, will select all of them (hundred to thousand ...), in that case will need a lot of optimize, if you dont want to do checking all of them!

Edited by greenpig83

Share this post


Link to post
Share on other sites

Thanks for the quick reply, i understand the view frustrum concept, i dont think its what i want, i just want to select aload of meshs with the mouse by making a dragable rect 

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!