I’m using the code from “gametutorial” (with a vector) for my collision detection and that’s works but for my engine, I need to find the coord. X, Y, Z of the impact on the polygon for applying decals, smoke effect.
I use this technic for using the gun but I need to calcul the coord. X, Y, Z of the impact on the polygon.
All you need to do is find the point where the projectile’s vector intersects the polygon. There are plenty of tutorials out there about finding the intersection of a vector and a polygon.
hum… well when you get your collision, you got the coord … did you have a close look to the functon ?
I assume you are using the polygon / line collision :
the IntersectedPolygon func calls IntersectionPoint which return the intersection point. so you only have to change a bit your function IntersectionPoint, by adding a reference-parameter, so that when calculating the impact coord, they are recorded in your value
OR you can throw a global variable called vIntersection and just delete the declaration in the IntersectionPoint so that “CVector3 vIntersection = IntersectionPoint(vNormal, vLine, originDistance);” became “vIntersection = IntersectionPoint(vNormal, vLine, originDistance);”
these tutorial are really good, everybody should look at them =)