O'Reilly logo

Panda3D 1.6 Game Engine by Dave Mathews

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - setting a range of bits with BitMask.range

Let's fix our BitMasks to work better for our purpose.

  1. In the setupCollisions method of our Cycle class, change the line where we set the Into collide mask for self.shieldCN to this:
    self.shieldCN.setIntoCollideMask(BitMask32.range(2,3))
    
  2. Save the file as CycleClass_03.py.
  3. Modify WorldClass_02.py to import CycleClass_03.py instead of CycleClass_02.py. Then, save it as WorldClass_03.py and run it from the command prompt. Attempt to collide the cycles together and we'll see that the collision is detected again, like in the following image:
Time for action - setting a range of bits with BitMask.range

What just happened?

Now our cycles can collide with each ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required