Return to Snippet

Revision: 6560
at May 30, 2008 12:25 by chombee


Updated Code
def addCollideMask(np,mask):
    """Add mask to the NodePath's existing collide mask (do a binary OR of
    the two bitmasks)."""
    np.setCollideMask(np.getCollideMask() | mask)

def removeCollideMask(np,mask):
    """Remove mask from the NodePath's existing collide mask (all bits set
    to 1 in mask will be set to 0 in the NodePath's mask)."""
    # Need to copy mask first to avoid modifying it in place.
    copy = mask & BitMask32.allOn()
    copy.invertInPlace()
    np.setCollideMask(np.getCollideMask() & copy)

Revision: 6559
at May 30, 2008 12:24 by chombee


Updated Code
def addCollideMask(np,mask):
    """Add mask to the NodePath's existing collide mask (do a binary OR of
    the two bitmasks)."""
    np.setCollideMask(self.np.getCollideMask() | mask)

def removeCollideMask(np,mask):
    """Remove mask from the NodePath's existing collide mask (all bits set
    to 1 in mask will be set to 0 in the NodePath's mask)."""
    # Need to copy mask first to avoid modifying it in place.
    copy = mask & BitMask32.allOn()
    copy.invertInPlace()
    np.setCollideMask(self.np.getCollideMask() & copy)

Revision: 6558
at May 30, 2008 12:20 by chombee


Initial Code
def addCollideMask(np,mask):
    """Add mask to the NodePath's existing collide mask (do a binary OR of
    the two bitmasks)."""
    np.setCollideMask(self.np.getCollideMask() | mask)

def removeCollideMask(np,mask):
    """Remove mask from the NodePath's existing collide mask (all bits set
    to 1 in mask will be set to 0 in the NodePath's mask)."""
    mask.invertInPlace()
    np.setCollideMask(self.np.getCollideMask() & mask)

Initial URL


Initial Description


Initial Title
Adding and removing collide masks

Initial Tags


Initial Language
Python