MaxZieb
(Loves Hype)
May 10, 2020, 2:46pm
6
Here is also a snippet concerning your request with a little demo. As its Matter.js based it should be probably pretty similar to the previous mentioned method.
This is an easy way to detect collisions and get the members involved in the collision. This simple example doesn’t deregister the event handler so keep that in mind when switching scenes.
Code (reduced to essentials):
// Fetch physics engine for our hypeDocument
var hypeDocElm = document.getElementById(hypeDocument.documentId());
var engine = hypeDocument.getElementProperty(hypeDocElm, 'physics-engine')
// Event listener
Matter.Events.on(engine, 'collisionStart', function(event)…