A case for collision filtering (again)

  • Hello,

    so I wanna make a case for collision filtering (again). "Again" as in this was mentioned a few times quite some years ago.

    construct.net/en/forum/construct-2/closed-bugs-22/physics-disable-collision-via-91905

    construct.net/en/forum/construct-2/general-discussion-17/ignore-selected-solids-workaro-107965

    construct.net/en/forum/construct-2/how-do-i-18/how-do-i-make-certain-physics-110979

    construct.net/en/forum/construct-2/bugs-21/request-example-per-instance-c-110783

    And actually ended up in r123 construct3.ideas.aha.io/ideas/C3-I-68

    But not with the physics behavior... :( And this is really bad when trying to create something with the physics behavior like a physics-platformer. Why? For example: A jumpthrough platform. Generally a very basic and important thing for platformers and kind of impossible to make properly with the physics behavior due to the lack of collision filtering.

    Two platforms that are supposed to be a jumpthrough platform, the player inbetween. And here is the problem already. It´s impossible to set these two platforms collisions individually. The physic behavior has the "enable/disable collision" action, but it doesn´t take picking into account. The result would be that either both platforms are solid, preventing the player from jumping through the top one, or both platforms are not solid, resulting in the player not beeing able to stand on the bottom one. I tried quite a bunch of possible workarounds, but none really work and usually come with their own set of problems. Even more so when enemies should also be able to interact properly with the jumpthrough platforms as there are potentially multiple enemies.

    Obviously it´s possible to work around it, like entirely forgo jumpthrough platforms. But I feel like the problem might just end up resurfacing with other cases. So... please? :)

    construct3.ideas.aha.io/ideas/C3-I-677

  • Make your own physics with events !!

  • Make your own physics with events !!

    No.

    Construct already offers an entire physics engine (box2d), and most likely, it´s doing it a gorillion times better (and more performant) than I could ever do with events. Not only that, but collision filtering is literally a feature of box2d. (https://www.aurelienribon.com/post/2011-07-box2d-tutorial-collision-filtering) I don´t think it´s unreasonable to request that feature to be made available rather than reinventing a worse version of something that already exists.

    Also that would be a gargantuan task on it´s own if you want to come close to emulating what box2d already does. I may be insane... but not that insane :)

  • WackyToaster

    Are you still looking for collision filtering in the standard C2 Physics engine? Reply if you still need it I can help you out.

  • Pandy

    Yes, I would still be interested in that. But it´s the C3 Physics engine (I know it´s both box2D but still things are likely different between C2 and C3.

  • Can't you just use 2 different platform objects? Then you can disable one without affecting the other.

    After that just a matter of designing levels so situations in your example only happen with top and bottom platform being these different objects, never the same ones.

  • WackyToaster

    Ah crap I did not see that it is for C3. I got to this thread from google search. But I think there should be some similarities between the two behaviors. I'm guessing nothing new is added from C2. I managed to get collision filtering working but I have run into some bugs. If I fix them I'll reply to this thread and reference you again. Then maybe we can see what can be done for the C3 behavior.

  • Can't you just use 2 different platform objects? Then you can disable one without affecting the other.

    That might work for the player alone, but if theres enemies that also should use these platforms in the same way it will again stop working. Like if the player is below the platform he has to be able to jump through, but an enemy walking on top of it should not suddenly fall through.

  • You can specify against which objects to enable/disable collisions so maybe that would work instead of completely enable/disable. You can hide a secondary platform behind the main one and have collisions against player disabled, so he can jump through while enemies could still stay on it. And do the opposite for the main platform.

    Assuming your enemies are like classic platformer enemies, just walking on a platform, not really doing the same thing as the player, it should work

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • BadMario

    Enabling/Disabling collisions results in all instances of an object having its collisions Enabled/Disabled. That makes things more complicated having to add more objects and events just to filter collisions.

    If you have 10 physics enemies, and one platform. You want enemy(1) to jump down (not collide with platform so it can move down) .Disabling collisions will disable collisions for all enemies and all will fall down.

    If you want individual control than you need 10 different physics objects as enemies and that means events for each enemy. This is a simple case, what if you want more enemies and more platforms? This just limits what you can do.

    But if you had collision filtering per instance than you just need one enemy object and one platform object and add how much ever of them you want.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)