PDA

Leyder Dylan
09-08-2002, 07:23 AM
Hi,

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.

How ?

ioquan
09-09-2002, 11:36 PM
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.

Try www.gametutorials.com. (http://www.gametutorials.com.)

Leyder Dylan
09-10-2002, 07:10 AM
I'm actually using the technic who comes from gameturorail, I've my collision but I need the impact coord on X,Y,Z

wizzo
07-31-2003, 12:35 AM
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 =)

wizzo