// Set up the billboard matrix
vecDir = camera.vecLookAt - camera.vecPosition;
if( vecDir.x > 0.0f )
D3DXMatrixRotationY( &mtxBillboard, -atanf( vecDir.z/vecDir.x ) + D3DX_PI/2 );
else
D3DXMatrixRotationY( &mtxBillboard, -atanf( vecDir.z/vecDir.x ) - D3DX_PI/2 );
D3DXMatrixMultiply( &mtxWorld, &mtxWorld, &mtxBillboard );
pD3DDevice->SetTransform( D3DTS_WORLD, &mtxWorld );
Any ideas? Thanks.
Billboarding on all 3 axis
I recently learned how to do billboarding by reading an old Direct3D SDK sample. It only shows how to billboard objects on the Y axis, and I was wondering how does it work with the X and Z axis? I tried playing around and trying to learn myself and searching google, but google was not my friend. Here's my code
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement