Billboard Wrong Rotation

This topic is 2054 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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 on other sites

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;

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
A4L
14
5. 5

• 9
• 13
• 26
• 10
• 11
• Forum Statistics

• Total Topics
633744
• Total Posts
3013662
×