• Advertisement
Sign in to follow this  

unit selection in strategy games (and others)

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

Hello, I already looked at "general picking" which is shown in one of the DirectX samples. But how do you select one or more units that lay within a rectangle or intersect it? And how do you call this kind of picking? My idea is to create 4 rays, one in each corner of the rectangle and then create with those 4rays and the near and far clipping plane a frustum and everything that intersects it or lays within it gets selected. Is this even possible? And if yes is it a good approach or are there better approaches? thanks

Share this post


Link to post
Share on other sites
Advertisement
ext,

What you're describing is indeed possible, and is referred to as "frustum picking." Assuming you have an optimized test for determining which objects lie within the frustum, it is a very efficient method for selecting multiple objects.

Many RTS games use the exact method you described to drag-select units.

Cheers and good luck!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement