Hi!
I make a platformer where the player can jump through the platforms. I got it working. I just wonder, what is the best way to make the player be able to jump through platforms? I use a trigger and disable the platform collider when the platform enter the trigger.
Here is what I did:
I have a Jump through platform trigger I parent to the player
In this trigger, I have 3 states.
-State 1:
Trigger Enter. I set the tag I use for the platforms and store the collider as a game object variable.
-State 2:
I have these actions:
-Wait - 0.5 sec. The time it takes before it enable the collider in the next state.
-Get Component. And I store the component in a variable. I call it Collider
-Set property. I use the variable I stored, (Collider). And disable it.
-State 3:
-Set property. Here I enable the collider again and send a finish event to state 1.
It works very well, but I discovered a problem when I have an enemy with rigid body on these platforms. When I jump through the platform, the enemy of course falling through the platforms, because I disable the collider.
So my question again is, is it another better way to do this?