Box2D Forums

It is currently Sat May 25, 2013 6:14 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Nov 03, 2010 5:22 am 
Offline

Joined: Sun Oct 31, 2010 10:25 am
Posts: 3
hello!

i dont understand how categoryBits works and how i can mask them in WCK.

how can i put multiple categoryBits in the maskBits field?


Top
 Profile  
 
PostPosted: Wed Nov 03, 2010 8:01 am 
Offline

Joined: Fri Jul 25, 2008 11:07 am
Posts: 16
I don't know WCK, but you can use the binary OR operator to set multiple bits.

Code:
   0000 0000 0000 0001 = 1
OR 0000 0000 0000 0010 = 2
----------------------
   0000 0000 0000 0011 = 3

So, if you have BIT1 and BIT2 you can use both with BIT1 | BIT2.


Top
 Profile  
 
PostPosted: Wed Nov 03, 2010 10:12 am 
Offline

Joined: Sun Oct 31, 2010 10:25 am
Posts: 3
thanks for answer.

i have found out this:

when i put "0xffff & ~0x0002" in the maskBits field then it collide with everything but not with the 0x0002 categoryBits.
but how can i add multiple categoryBits to not collide with it?


Top
 Profile  
 
PostPosted: Sat Nov 06, 2010 1:01 am 
Offline

Joined: Wed May 13, 2009 9:20 am
Posts: 45
You know that
0xffff & ~0x0002
allows collision with everything except 0x0002
so by extension
0xffff & ~0x0001 & ~0x0002
allows collision with everything except 0x0001 and 0x0002


Top
 Profile  
 
PostPosted: Mon Dec 27, 2010 9:20 am 
Offline

Joined: Tue Dec 14, 2010 10:38 am
Posts: 18
This is not working for me. I have the categoryBits for the objects that I do not want to collide set to 0x0002, and I have both of their maskBits set to 0xFFFF & ~0x0002, but they are still colliding. Does anyone know of something I'm missing? Thanks for your help!


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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