Selective Collision Detection

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Selective Collision Detection

Post 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.
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post 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
Tomasz Nowakowski
Openoko - www.openoko.pl
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post 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?
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post 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.
Tomasz Nowakowski
Openoko - www.openoko.pl
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post 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.
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

LOL, sorry, i just didn't get you right :)
BTW i meant bool as a general data type, not only c++.
Tomasz Nowakowski
Openoko - www.openoko.pl
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post 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
warui
Posts: 232
Joined: Wed Apr 14, 2004 12:06 pm
Location: Lodz, Poland
Contact:

Post by warui »

Yeap, there's definitely some misunderstanding, but not on my side ;) Here's why:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?p=16226
Tomasz Nowakowski
Openoko - www.openoko.pl
Post Reply