RTS Selection box in 3D, How?

Started by
11 comments, last by ajoling 18 years, 7 months ago
Hi,

Check this link:

http://www.gpwiki.org/index.php/Object_selection_lasso

hth :)
www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>
Advertisement
Quote:http://www.gpwiki.org/index.php/Object_selection_lasso
The OP can correct me if I'm wrong, but I think his code is already based off that article.
Try using an identity matrix for the matWorld matrix;

D3DXMatrixIdentity(&matWorld);

And you need to use transformed coordinatres for comparison:

if( D3DXPlaneDotCoord( &plane

, &D3DXVECTOR3( min.x, min.y, min.z ) ) >= 0.0f )
continue;

Those min/max values need to be transformed, since it's the bounding box of your object, simpply transform it by the matrix you used to render the object/unit.

www.persistentrealities.com for Inline ASM for VB, VB Fibre, and other nice code samples in C++, PHP, ASP, etc.<br/>Play Yet Another Laser Game!<br/>

This topic is closed to new replies.

Advertisement