Concave + SAT + Tringulation

Started by
4 comments, last by ardmax1 13 years, 7 months ago
Hi,
Im working on my 2d physics engine, its working quite well as for first engine, im using convex polygons only but now i want to add concave ones. So i create new concave polygon, i tringulate it, and heres part i dont know how to solve. I was using SAT for convex polygon collision detection, but now i dont know how to test both tringulated polygons with SAT.

Can it be done with SAT, or i need other technique ?
Advertisement
I would think you could do SAT for the convex pieces of your concave shape, just ignoring their intersection with eachother?

I might be really far off though...
I mean i have both tringulated shapes in vector, and how should i sat_check them to get collision result. Ill show part of code:

pTringulation T;vector< shape > tria;vector< shape > trib;T.process(polya,tria);T.process(polyb,trib);


and with convex shapes i was using this

satCheck(polya,polyb);


now how i do this with concave ?
the general method when using sat for concave shapes is to simply ignore the fact that the concave shape is concave, and treat it as though it is simply convex shapes where obviously the velocity is based on the entire concave body, and the impulses applied to the entire concave body.
But ignoring that concave shape is concave and just using SAT as it is convex, will give wrong collision detection. So any other way to do this ?
Ok, i have some progress. I tried using SAT with each tringle in each polygon, and then sorting collisions by MTV, but its not perfect, it sometimes misses collision with some triangles.

Heres how i do it

	pTringulation T;	vector< shape > tria;	vector< shape > trib;	T.process(polya,tria);	T.process(polyb,trib);	for(int i = 0; i < tria.size(); i++){	        for(int j = i + 1; j < trib.size(); j++){			satCheck(tria,trib[j]);		}	}

This topic is closed to new replies.

Advertisement