General about Contacts

Hi guys,

after reading the doc about contacts, i didnt get smarter =)

Im using C++ for the programm and want to detect the collision between two bodies/shapes.
This is my idea/pseudo-code

Code:
if (ContactExist(body1,body2)
{
// do sth.
}


Thanks for help

unknown
Can nobody help me ?
hmm , if its to difficult to explain how it works, can someone say where it is explain well or explain me sth like this

Code:
if contact(body)


So if the body contact with sth.


Greetz unknown
There are lots of topics here on this with lots of examples. Implement the ContactListener interface, copy contacts there for handling after the time step. That way you're handling "now known" contacts rather than polling the system with "if (ContactExist(body1,body2)" type code.

Bill
See: b2ContactListener

See testbed example: test_ContactCallbackTest

b2ContactListener is implemented in test_main
neonnds wrote:
See: b2ContactListener

See testbed example: test_ContactCallbackTest

b2ContactListener is implemented in test_main



Looked at that 😉 but not really understand it...

Someone have some example (codes) for me ?

Original thread: https://box2d.org/forum/viewtopic.php?t=1311