# Contact Points[2D][Edge vs Point]

This topic is 2631 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm having problems with rotating rigid bodies because my method of finding contact points is flawed.

Sometimes the rotational velocity spikes on some rigid bodies because of incorrect contact points.

What I do currently, is find the point on the polygon the lowest along its contact normal.
The problem is that i will find two contact points and i have no idea on how to determine which contact point is the real contact point.

Here is what my code looks like for finding contacts for each polygon:

 template<class Shape> static void Find_POI(Shape * A,Vector2D MTD,Vector2D & CPmin){ //MTD is contact normal, CPmin is returning a contact point byref float Dot[10]; Dot[0] = MTD^(*A->PointList[0]); float Min= Dot[0]; int MinIndex = 0 ; for(unsigned int K = 1; K < A->PointList.size(); K++){ Dot[K] = (*A->PointList[K])^MTD; if(Dot[K] < Min){ Min = Dot[K]; MinIndex = K; } } CPmin = *(A->PointList[MinIndex]); } 

My Question is:
How do you guys find your contact points(Edge vs Point)?
Am i going in the right direction with my method or am i completely wrong?

##### Share on other sites
Can't understand - how did you get 2 contact points? In case of edge-point the projection on normal (assuming that you separate bodies from penetration) should return total 3 points - vertex of the object that penetrates and two vertices of an other object edge. In that case you should take only the first point - i.e. vertex of object that penetrates.

##### Share on other sites

My Question is:
How do you guys find your contact points(Edge vs Point)?
Am i going in the right direction with my method or am i completely wrong?

Take a look at my article on the physics and collision detection of an angry birds style game - scroll down a bit, I discuss generating the contact set which sounds like what you are after:

http://www.wildbunny.co.uk/blog/2011/06/07/how-to-make-angry-birds-part-2/

Cheers, Paul.

##### Share on other sites

Take a look at my article on the physics and collision detection of an angry birds style game - scroll down a bit, I discuss generating the contact set which sounds like what you are after:
http://www.wildbunny...y-birds-part-2/

Cheers, Paul.

Thanks for the article.This method makes a lot more sense than what i was doing.
*EDIT*
It worked.
Rigid bodies no longer Spin-out thanks to a proper contact finder.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5
khawk
11

• 9
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633679
• Total Posts
3013299
×