Select multiple units with some sort of 2D box

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

Select multiple units with some sort of 2D box

Post by badday »

Hi there,

I´m looking for some way to select mutliple units (e. g. 3D-Models). Is there some built-in functionality or does someone know an easy way to do that (with mouse-key events etc.)?

I´m sorry for the stupid title, but I don´t know how to call that. To make things clear: If you press the left button of your mouse and move it (left button still down) you see a quadrangle. That´s what I´m looking for.


Thanks a lot.


Greetings,

badday
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

If you have a 3d scene, you actually need to convert that 2d box on screen into a pyramid (view frustum). The top of the frustum is the camera position, and the corners are the points on the box. Then you just search through the scene looking for nodes that are inside the view frustum.

This has been discussed before. You should be able to search for frustum and picking and you should find something relevant.

Travis
badday
Posts: 102
Joined: Mon Aug 16, 2010 1:14 pm

Post by badday »

Well, I just searched for "frustum picking" but couldn´t find something useful (as far as I can see it). Do you remember the topic related to this problem?

Thanks,

badday
lymantok
Posts: 67
Joined: Mon Dec 31, 2007 6:13 am

Post by lymantok »

I think you might be looking for this post by rogerborg:

http://irrlicht.sourceforge.net/phpBB2/ ... ode+select

He has also posted a number of other useful snippets on rts movement arrow and moving groups, etc, so you might want to search for rogerborg postings if the above link is not exactly what you are looking for.
Post Reply