Box2D Forums

It is currently Wed May 22, 2013 1:46 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: General about Contacts
PostPosted: Fri Aug 22, 2008 10:45 am 
Offline

Joined: Fri Jul 18, 2008 7:23 am
Posts: 47
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


Top
 Profile  
 
PostPosted: Sun Aug 24, 2008 6:18 am 
Offline

Joined: Fri Jul 18, 2008 7:23 am
Posts: 47
Can nobody help me ?


Top
 Profile  
 
PostPosted: Sun Aug 24, 2008 10:19 am 
Offline

Joined: Fri Jul 18, 2008 7:23 am
Posts: 47
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


Top
 Profile  
 
PostPosted: Sun Aug 24, 2008 12:45 pm 
Offline

Joined: Tue Feb 12, 2008 4:54 pm
Posts: 130
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


Top
 Profile  
 
PostPosted: Sun Aug 24, 2008 9:15 pm 
Offline

Joined: Sun Jul 20, 2008 6:48 am
Posts: 25
See: b2ContactListener

See testbed example: test_ContactCallbackTest

b2ContactListener is implemented in test_main


Top
 Profile  
 
PostPosted: Mon Aug 25, 2008 6:33 am 
Offline

Joined: Fri Jul 18, 2008 7:23 am
Posts: 47
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 ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group