Jump to content
  • Advertisement
Sign in to follow this  
Medo Mex

Billboard Wrong Rotation

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

When I draw a bullet impact billboard I'm getting wrong rotation, the bullet impact billboard is looking at the mesh, instead of looking at the player.

 

So that cause when I turn the cull mode off, I don't see the bullet impact billboard.

 

Here is how I get the billboard vertices position for drawing:

D3DXVECTOR3 up = v0 - hitPoint;
D3DXVECTOR3 nrm = GetTriNormal(v0, v1, v2);
D3DXVECTOR3 right;
D3DXVec3Cross(&right, &nrm, &up);
D3DXVec3Normalize(&up, &up);
D3DXVec3Normalize(&nrm, &nrm);
D3DXVec3Normalize(&right, &right);
float size = 0.4f;

D3DXVECTOR3 horizontal = right * size;
D3DXVECTOR3 vertical = up * size;
D3DXVECTOR3 bulletBillboardV1 = hitPoint - horizontal + vertical;
D3DXVECTOR3 bulletBillboardV2 = hitPoint + horizontal + vertical;
D3DXVECTOR3 bulletBillboardV3 = hitPoint + horizontal - vertical;
D3DXVECTOR3 bulletBillboardV4 = hitPoint - horizontal - vertical;
// Code to draw the billboard according to bulletBillboardV1, bulletBillboardV2, bulletBillboardV3, bulletBillboardV4 here...

 

Now, I want to turn the cull mode off and see the billboard, how do I make the billboard look at the reversed direction?

Edited by Medo3337

Share this post


Link to post
Share on other sites
Advertisement

Resolved!

 

I had to change the + and - signs:

 

D3DXVECTOR3 bulletBillboardV1 = hitPoint + horizontal + vertical;
D3DXVECTOR3 bulletBillboardV2 = hitPoint - horizontal + vertical;
D3DXVECTOR3 bulletBillboardV3 = hitPoint - horizontal - vertical;
D3DXVECTOR3 bulletBillboardV4 = hitPoint + horizontal - vertical;

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!