I'm trying to place a bullet hole billboard, unfortunately I can't get it to work correctly, so I need help to correct my code.

LPD3DXMESH mesh = GetMesh(); D3DXVECTOR3 *vertices; mesh->LockVertexBuffer(D3DLOCK_READONLY, (void **)&vertices); for(int j = 0; j < mesh->GetNumFaces(); j++) { v1 = vertices[j]; v2 = vertices[j+1]; v3 = vertices[j+2]; if (D3DXIntersectTri(&v1, &v2, &v3, &rayOrigin, &rayDirection, NULL, NULL, NULL)) break; } mesh->UnlockVertexBuffer(); mesh->UnlockIndexBuffer(); // Calculate the bullet billboard quad position D3DXVECTOR3 p = GetHitPoint() D3DXVECTOR3 A = v2 - v1; D3DXVECTOR3 B = v3 - v1; D3DXVECTOR3 N; D3DXVec3Cross(&N, &A, &B); D3DXVec3Normalize(&N, &N); D3DXVECTOR3 up; D3DXVec3Normalize(&up, &(p - v1)); D3DXVECTOR3 right; D3DXVec3Cross(&right, &up, &N); float scale = 2.0f; D3DXVECTOR3 Q1 = p + up * scale; D3DXVECTOR3 Q2 = p - up * scale; D3DXVECTOR3 Q3 = p + right * scale; D3DXVECTOR3 Q4 = p - right * scale; AddBillboard("bullet.png", Q1, Q2, Q3, Q4);