I am using Platform Effector 2d to make one-way platforms.
By pressing Down+Jump, the players should be able to move downwards through the platform, landing on whatever is below.
Being very new to Unity, I looked online to see how other people obtain this, but the only solution talked about is to set the platform’s Collider to a Trigger for the duration of the traversal.
This works very well if there is a single player on that platform, but won’t work for a multiplayer game.
I tried a few workarounds such as making thin platforms and changing the player’s rigidbody position directly, but the results are buggy and jerky, and I feel I am working against Unity rather with it.
What would be a solid way to implement multiplayer-friendly platform jump-down?
Afaik there’s an api with which you can directly set two colliders to ignore each other.
Maybe you can only disable it on the local client and on the server you move the character down below the platform.
edit:
It has a parameter to undo it as well.
Other than that, another workaround would be to instantly move the player and animate the visual position / renderer towards the real position.
If its multiplayer you’d have to do some interpolation anyway.
In any case, just from the logic of what is supposed to happen, the thing that makes most sense is simply ignoring the collision between the two for a short time. And since you can do it per-collider that should work pretty well.
I tried that already.
The difficulty becomes to find out when I should stop ignoring collisions.
If I restore the collision when the main collider is still inside the platform, Platform Effector 2D will bounce the player back upwards.
Thanks for the help, seems like a workaround is the way to go.