# stc.5421

Member

7

119 Neutral

• Rank
Newbie

2. ## Creating Bullet Holes

And what's your problem right now? Can you get information from RayResultCallback ?
3. ## Creating Bullet Holes

Did you do intersect to your mesh by D3DXIntersect function?
4. ## Calculate screen co-ords from a point in 3D space

Simply transform your 3d position by view projection matrix . md3dDevice->GetTransform(D3DTS_PROJECTION,&pm); md3dDevice->GetTransform(D3DTS_VIEW,&vm); D3DXMATRIX vp; D3DXMatrixMultiply( &vp, &vm, &pm ); D3DXVECTOR4 posBase; D3DXVec4Transform(&posBase,&D3DXVECTOR4(m_positionVal.x,m_positionVal.y,m_positionVal.z,1.0f),&vp); posBase.x/=posBase.w; // Screen space X pos posBase.y/=posBase.w; // Screen space Y pos posBase.z/=posBase.w;
5. ## Creating Bullet Holes

You don't need it , that create a quad align to the mesh face .
6. ## Creating Bullet Holes

1- "p" is your intersected point 2- "v1,v2,v3" are your intersected face vertices 3- "N" is your face normal or you can calculate it from your vertices { A = v2 - v1 B = v3 - v1 N = normalize( cross( A , B ) ) } 4- Calculate your Up and Right vector { up = normalize( p - v1 ) right = cross( up , N ) } 5- "Q1,Q2,Q3,Q4" are your Quad vertices and can calculate like this { Q1 = p + up * scale Q2 = p - up * scale Q3 = p + right * scale Q4 = p - right * scale }
7. ## Creating Bullet Holes

hey you can use a decal system like this http://www.humus.name/3D/VolumeDecals.zip