Skip to content

Instantly share code, notes, and snippets.

@worldoptimizer
Created September 12, 2020 12:59
Show Gist options
  • Save worldoptimizer/2bbd77cfa581142fb0ae5c445a679eda to your computer and use it in GitHub Desktop.
Save worldoptimizer/2bbd77cfa581142fb0ae5c445a679eda to your computer and use it in GitHub Desktop.
hypeDocument.disablePhysicsCollisions
/**
* 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