Created
November 12, 2009 11:07
-
-
Save seanh/232817 to your computer and use it in GitHub Desktop.
Adding and removing collide masks (Python, Panda3D)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment