BitMask intervals

Hello fellows

There’s some way to set BitMask intervals in a CollisionNode?
Example … i want a CollisionNode have a fromCollideMask between BitMask32.bit(1) and BitMask32.bit(5) … there’s some way?

Thanx

I’m not sure if I understand your question right. Are you asking for a BitMask32 with all bits from 1 to 5 set, while bits 0 and 6+ are not set? Like “…0000111110”? In this case you culd use:

BitMask32.setRange(int low_bit, int size)

Or if you don’t want all this explicit conveniance stuff and do it yourself, like a real programmer (not serious here, but see yourself: http://www.ee.ryerson.ca/~elf/hack/realmen.html):

mask = BitMask32((1<<6)-2)

Because:

>>> bin((1<<6)-2)
'0b111110'

http://www.panda3d.org/reference/devel/python/classpanda3d.core.BitMask32.php

There is setRange function, didnt quite test it yet (dont have panda on this computer).

Also, you could do it in python style :slight_smile:

for i in range (1,6): #1,2,3,4,5
    bitmask.setBit(i)
    

Yessssss
Thanx Buddies