Contact. Help!

Discuss issues specific to the Flash/AS3 port of Box2D
kestorr
Posts: 32
Joined: Tue May 22, 2012 2:37 am

Contact. Help!

Postby kestorr » Tue Jan 22, 2013 8:01 am

Hello there.

Guys im strugling for some time now.
I have a problem with the damned contact though it seems simple at a first glance!

So its like this. I want to find out whos touching a certain object like in the code below:

Code: Select all


var body2:b2Body;
if(oneActor.oneBody.m_contactList)
{
   body2=oneActor.oneBody.m_contactList.other;   
}




So the code is doing something like this: if there is a contact with the oneBody, makes body2 the body in contact with oneBody.
If there is no contact it doesnt do anything.

All works fine untill you find out that even though noone is touching oneBody still body2 becomes a certain body.
Thats because from what i read the aabbs of the 2 bodies overlap.

Now thats breaking my game engine! How can i check if 2 bodies really are touching and not their aabbs overlap.
I would prefer not to involve the contact listener if its possible (since its a simple line of code).
Its good to mention that i use box2d 2.02 version.


Help!

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: Contact. Help!

Postby irresistible force » Tue Jan 22, 2013 8:54 am

I don't know about Flash but in C++ you can do contact->IsTouching() to see if the shapes are actually overlapping.

kestorr
Posts: 32
Joined: Tue May 22, 2012 2:37 am

Re: Contact. Help!

Postby kestorr » Tue Jan 22, 2013 9:07 am

I cant seem to find that IsTouching() thingie. Is that in 2.02?


Return to “Flash”



Who is online

Users browsing this forum: No registered users and 2 guests