Unit selection 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
dutt
Posts: 8
Joined: Tue Sep 21, 2010 10:10 am

Unit selection box

Post by dutt »

Does irrlicht support selection by 2d-box somehow? I'm making a very simple space rts and want support the usual kind of "drag out a box and all units in the box get selected".

Otherwise, what's the simplest way of doing this? I'm making a 3d-game, very simple stripped down homeworld-ish rts.
freetimecoder
Posts: 226
Joined: Fri Aug 22, 2008 8:50 pm
Contact:

Post by freetimecoder »

If you have a 2d box you should have the 2d screen coordinates of the corners. Then you can get the unit's screen coordinates by using scenemanger->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition(unitposition) Then you can compare the 2d position with the selection box.

Don't know if this is the easiest/fastest way, but it worked for me.

greetings
Post Reply