Archived

This topic is now archived and is closed to further replies.

ggsm81

Making a drag box on the terrain

Recommended Posts

Hello~ In WarCraft3, when you select a unit, there will be a green circle appearing under the unit and that circle''s shape will change depend on the height of the terrain. Same will happen when you drag a selecting box. Does anyone know how make the circle and the drag box like that? Thanks

Share this post


Link to post
Share on other sites
look at the pick sample in the sdk, it helps convert screenspace x and y to worldspace x, and y, instead of comparing to a mesh compare to your ground, that''ll get you the co-ordinates to check against, (x, and y on WM_LBUTTONDOWN and WM_MOUSEMOVE x, and y) next check if each unit is within that rectangle, if it is draw a circle under it.

for lining up the circle, use the same world transform as your unit, (your unit lines up with the ground already right?) this might not be the best idea for alot of circles to draw as it''s many calls to drawprimitive though. if you can make all the circles one vertex buffer, and align them using the code that creates your world transforsm for the unit''s.

Share this post


Link to post
Share on other sites