Created
September 12, 2020 12:59
-
-
Save worldoptimizer/2bbd77cfa581142fb0ae5c445a679eda to your computer and use it in GitHub Desktop.
hypeDocument.disablePhysicsCollisions
This file contains 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
/** | |
* Remove phyics elements from the regular Matter.js collision group | |
* | |
* @param {Nodelist} targetElms The target elements to remove | |
*/ | |
hypeDocument.disablePhysicsCollisions = function(targetElms) { | |
targetElms.forEach(function(elm){ | |
var elmBody = hypeDocument.getElementProperty(elm, 'physics-body'); | |
if (elmBody) elmBody.collisionFilter = { 'group': -1} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment