Hi there. I need a function, property which can disable my player body for couple seconds (or disable collision). Anybody have an idea? I using matter physics.
https://jsfiddle.net/ejbayrs8/1/
Anybody has similiar issue?
I think the way you think is correct, collision categories and collision groups. They are explained in the docs and has examples (labs).
Alternatively you can use a flag instance variable like collisionsIgnored
and toggle it in setTimeout
. Use this flag in the logic of your collision detector’s processCallback
which is the callback that comes after the collisionCallback
and determines if your collisionCallback
will be called or not and returns a boolean.
Or to achieve same but also be able to select for what object the collision will be ignored you can ignore the processCallback
(pass null
instead) and apply same logic in the collisionCallback
, like if the flag is equal that value and one of the colliding object’s are the player, you collision callback, Do nothing else do that. Do nothing is return false
here.
I have used the object and body interchangably but you got the idea.