Jump to content

  • Log In with Google      Sign In   
  • Create Account


Dragable picking


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Anddos   Members   -  Reputation: 416

Like
0Likes
Like

Posted 14 December 2013 - 03:22 PM

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, 14 December 2013 - 03:22 PM.

:)

Sponsor:

#2 greenpig83   Members   -  Reputation: 287

Like
0Likes
Like

Posted 14 December 2013 - 03:36 PM

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, 14 December 2013 - 03:42 PM.


#3 Anddos   Members   -  Reputation: 416

Like
0Likes
Like

Posted 14 December 2013 - 03:44 PM

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 


:)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS