Making a drag box on the terrain
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
#include "premadelibrarythatdoeseverythingforyou.h"int main() { MakeCheapWarcraftIIIClone(); return fameAndFortune;}
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement