Page 1 of 1
Selective Collision Detection
Posted: Sat Jun 19, 2004 12:50 pm
by Tyn
Hey all
Has anyone sucessfully managed to do collision on only a specific model? The API says something about only doing collision on models that match the bit map mask. I thought it might be the ID of the model but when I tried, it had no effect. This is what it says in the API:
idBitMaks: Only scene nodes with an id with bits set like in this mask will be tested. If the BitMask is 0, this feature is disabled.
Posted: Sat Jun 19, 2004 3:43 pm
by warui
There's bug in irrlicht. Actualy it's only checked if one of the bit of the mask is set in a node ID, not all of them.
If we have mas like this:
00110
all of those ids will be treated sa ok:
00010
00100
00110
and here's how to correct it:
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2859
Posted: Sat Jun 19, 2004 5:00 pm
by Tyn
So, if I set an ID of a node to 5 and I want to only collide with that node, I want to do check for bit mask 101? But the way it is working at the moment, the following would be checked?
1
100
101
Right? I think I get you. I thought a bit was just one bool and 16 bits = a word, but I was pretty tired when it was explained to me
Am I expected to pass the binary figure down to the function or will Irrlicht do the conversion on a low level?
Posted: Sun Jun 20, 2004 1:11 am
by warui
You got me perfectly right
About bits, bytes and words:
bit is the smallest unit of storage used in computers, it can only be 0 or 1 (but don't confuse it with bool data type, bool is usualy at least one byte)
byte is eight bits (ok, usualy

, for example there are some c++ implementations that uses 16bits, 32bits or even 64bits bytes, but it's not something you should worry about)
word is two bytes
And about last question.
Everything is stored as binary in computers

Just pass the right s32 and it will be ok.
Posted: Sun Jun 20, 2004 1:25 am
by Tyn
A binary is a boolean as it has only two states, on or off, true or false. Although that is a little different from the C++ type. I understand what you mean but the definition of boolean extends past the C++ type. I've been using it as a boolean all week so the term has pretty much stuck, lol.
I only ask because I've been working on a low level drive at work that is pretty much as basic as you can get, pushing bits across a word to change a state, lol. It just seemed a little strange for the function to mention a bit when you don't need to think at that level. I thought maybe there was a C++ type for binary numbers I didn't know about. It makes me wonder if the point of the function was to do exactly what it is doing now, it just wants the bit in the right column?
After the week I have had with converting BCD to binary and to integer ( and back

) I never want to work on that level again.
Posted: Sun Jun 20, 2004 1:36 am
by warui
LOL, sorry, i just didn't get you right

BTW i meant bool as a general data type, not only c++.
Posted: Sun Jun 27, 2004 7:34 pm
by jox
I think there are some misunderstandings about
bit masks. Please see my explanation and bug-fix-fix

here:
http://irrlicht.sourceforge.net/phpBB2/ ... 6203#16203
Posted: Mon Jun 28, 2004 1:14 am
by warui
Yeap, there's definitely some misunderstanding, but not on my side

Here's why:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?p=16226