Open dxu opened 7 years ago
ah, never mind. I noticed that there is a unique pairID for collisions between two objects, so I can differentiate collisions based off that, I'm guessing?
So are new collisionStarts just any time there is a collision between two objects with a new contact point?
I've not yet had chance to look into this - did you resolve it or was it a misunderstanding? Collision start should only really fire once for each pair, until the body moves out of contact.
Oh, sorry! I thought I was just misunderstanding how the collisions were supposed to work. So if a box lands on its corner (assuming 0 restitution), and then falls flat onto the ground, collisionStart
should only fire once in that case?
I'll reopen in case I'm misunderstanding my misunderstanding.
Yeah it should fire once, then multiple collisionActive
then finally collisionEnd
. Can you share your test case?
Here were the examples I was testing with, I console.log the events.
Only collisionStart
Only collisionEnd
Only collisionActive
All events
I get ~9-15 collisionEnd
events (seems to be inconsistent across refreshes), ~12-17 collisionStart
events
Thanks for this, will check it out.
Hi! I faced the same issue. Are there any updates?
"matter-js": "^0.17.1",
The behaviour is the same as @dxu provided above. Although two bodies already started collision (in my case moving through each other), for some reason I receive several groups of (1 collisionStart, lots of collisionActive and 1 collisionEnd) events, but I assume it is expected as 1 group of these events.
@gokadi can you check Matter.version
is it 0.18.0
?
If so can you try out the alpha build file included this PR? https://github.com/liabru/matter-js/pull/1079
Be great to know if it resolves, here's the discussion on it https://github.com/liabru/matter-js/issues/1077
Hi! I faced the same issue. Are there any updates? The same issue is happening to me on 0.19.0
Hi! I wrote up a small plugin for adding collision events to bodies, but I'm looking to use this elsewhere, and I'm noticing that the 'collisionStart' event is being fired a lot of times compared what I would expect is a single collision between two boxes.
You can run the example included in the repo, but essentially I have two squares,
BoxA
andBoxB
, falling onto the ground at different heights. I expected that there would be 3collisionStart
's (and 3 correspondingcollisionEnd
's), while there might be a bunch ofcollisionActive
's:BoxA
hits GroundBoxB
hitsBoxA
(BoxB
is aboveBoxA
)BoxB
falls over, hits Ground.But instead I get something along the lines of 10-20 collisionStarts and Ends.
Is this intentional / expected? Am I doing something wrong?
Thanks for the great work you've done with this engine! It's really awesome, and I'm looking forward to playing with it further!