Posted: 26th Jun 2007 17:12
So, I've got Sparky's dll and I've got it detecting collisions between 2 3d polygons, but now I want to know where the collision is happening so I can determine the next set of events to occur. For instance, I could dent the shape that got hit with the other.

Anyhow, how do I go about getting this sort of information? The x, y z of a collision point?

Does Sparky's not support this?

I've tried raycasting from all the vertices but that doesn't return any collisions. It's very strange. I do have a another idea, though it's a little clumsy. I'll place a small sphere or cube at each of the vertices and record which ones it collides at. I'll try it while awaiting a response on here.
Posted: 26th Jun 2007 17:58
assuming the raycast gives you the distance from [from]XYZ to [to]XYZ,

set up a triangle and use right-angle trigonometry to find [collision point]XYZ (which is a point along the line from [from]XYZ to [to]XYZ)
Posted: 26th Jun 2007 19:27
One thing, if two polygons are touching, the intersection could be one of 3 things:

1)A point (if one vertex of the poly touches the other poly)
2)A line (if one poly goes through the other)
3)A polygon (if they line up perfectly)

Almost always, it would be the second one. So, there is no actual "point of intersection", it would actually be a line segment. You would have to find both of the endpoints of this line in order to dent your object or anything like that.
Posted: 26th Jun 2007 20:56
Ok. So I figured out how to get the collision points. Once I showed myself visually what vertices and rays I was checking, I realized it was displaying at the origin (0, 0 , 0) of the world. So I offset the vertexdata coords by the position of the object and then the raycasting worked.

Next step. How to dent based on that coordinate...

How do I subtract one poly from another? Any built in functions to do this? In 3d editors I believe it's called CSG subtraction.
Posted: 3rd Jul 2007 22:50
Found csg subtraction in dark basic pro on the forums.

It's even better than I thought. Now when I know these two objects have collided, I can either move the object back up out of the other to the point of impact, or I can start to dent that other object as it moves into the other. I'll have to slow down the velocity of the moving object as it does this.

See this forum post for an example of csg subtraction.


http://forum.thegamecreators.com/?m=forum_view&t=108613&b=6&p=0