15 replies to this topic
#1 Members - Reputation: 375
Posted 05 December 2012 - 09:47 PM
Hi everyone,
How do I calculate the billboard transformation to make a bullet hole at certain point on a mesh?
The mesh can be complicated (building, vehicle, interiors, etc...), so I'm looking for a way to place the bullet hole billboard on the mesh at the point the player is shooting.
How do I calculate the billboard transformation to make a bullet hole at certain point on a mesh?
The mesh can be complicated (building, vehicle, interiors, etc...), so I'm looking for a way to place the bullet hole billboard on the mesh at the point the player is shooting.
Sponsor:
#5 Members - Reputation: 115
Posted 06 December 2012 - 09:11 AM
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
}
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
}
Edited by stc.5421, 06 December 2012 - 09:20 AM.
#14 Members - Reputation: 115
Posted 08 December 2012 - 12:31 PM
Sorry for delay , use this:
http://bulletphysics.org/Bullet/phpBB3/download/file.php?id=588
http://bulletphysics.org/Bullet/phpBB3/download/file.php?id=588
Edited by stc.5421, 08 December 2012 - 12:32 PM.
#15 Members - Reputation: 375
Posted 09 December 2012 - 08:07 PM
Hi stc.5421,
I will be using D3DXIntersect() instead, how can I get the intersected face vertices when I use D3DXIntersect()?
Also, where normalize() and cross() are located? Do you mean btVector3::normalize() and btVector3::cross()?
I will be using D3DXIntersect() instead, how can I get the intersected face vertices when I use D3DXIntersect()?
Also, where normalize() and cross() are located? Do you mean btVector3::normalize() and btVector3::cross()?
Edited by Medo3337, 09 December 2012 - 08:26 PM.






