-
Notifications
You must be signed in to change notification settings - Fork 93
Collision detected but touches not assigned #130
Comments
@bilou84 Hey! Do you think you'd have the time to look at this anytime soon? I've hacked together something in my local version for now (removing the |
Sorry it took so long to get back at you. Will have a look this weekend! |
Ok, so the check is basically to make sure your body is currently moving in the direction of the intersection. It prevents for instance a motionless body to get pushed by another because this is not supported at all. You can easily give it a shot with this game https://github.com/superpowers-extra/octofoot-game. But you are correct that we should still set the touches value correctly so I will fix that. |
Thanks for reporting the problem ;) |
Great! I see it now. Thanks for fixing, I'll give that a go :) |
the bug is still here (version 2.0) , this fix will be avaliable on the next relase or it should already be working? |
It will be on the next release, probably by the end of the month |
thanks :D |
Hi there,
I'm playing with collisions and I've made an NPC and a PC Actor with an
arcadeBody2D
components. They both move fine on the Tile Map but when I go to check collisions between the two actors I get strange results.The collision is detected (
.collides
returns true and.detachFromBox
is called) but all thetouches
are marked as false. I've looked at the code in.detachFromBox
and it seems to go through the firstif
statement fine (detecting if it's on the Y or X axis) but then there's anotherif
inside which checksbody1.deltaX() / insideX > 0
(https://github.com/superpowers/superpowers-game/blob/master/plugins/default/arcadePhysics2D/components/index.ts#L40) and this one seems to be causing problems.Because that statement is not true (
deltaX
is negative) it never gets in to assign the touches. If I remove thatif
condition, it seems to work fine. I can't quite understand what that condition is supposed to guard against but in any case, shouldn't there be anelse
to fill in the blanks? Having a collision but no touches is quite confusing.Here's a demo of what's happening: https://gfycat.com/UnevenFamousKilldeer
The code looks like that (in the update call of the Dino):
As you can see in the video, none of this gets logged.
Additionally, I've put logs in the code of
detachFromBox
which you can see the video:I hope I'm missing something silly but I've checked a few things (removing offsets/resizing the hit boxes) and nothing works. The only time it seems to work is when the PC doesn't move and the NPC collides with it.
The text was updated successfully, but these errors were encountered: