You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to have it so my character can drop down through one way platforms by pressing the down arrow key. Many games with one-way platforms let you do this such as Mario, Kirby, Smash Bros, etc.
I was able to get the conditional working to see if I was standing on something in the "OneWayPlatform" layer, but I can't figure out how to get my character to fall through it. I tried both IgnoreCollision and IgnoreLayerCollision and neither seemed to do anything. My guess is that this has something to do with the layer mask inside the CharacterController2D script, but I have no idea how that works. I am stumped!
If anyone could explain to me how to do this or point me in the right direction that'd be great!
The text was updated successfully, but these errors were encountered:
I was looking at this issue a little while back. The solution I opted for was to add a little functionality to partial class. This way I would be able to incorporate any updates to the core CharacterController2D while avoiding most merge/update issues.
The process I used was:
Store existing LayerMasks
Manipulate LayerMasks when enabling/disabling OneWayPlatforms
Then I set OneWayPlatformsActive = false when the down key is pressed, and OneWayPlatformsActive = true when the key is released.
Oh man thank you so much, I just implemented it and it seems to work! I would've never figured it out without you. I was reading up on the "|" and "&" operators and bitwise stuff to try and work with layer masks but It's much simpler than I thought. I've also never used a partial class before so you taught me something new, brilliant!
I'm trying to have it so my character can drop down through one way platforms by pressing the down arrow key. Many games with one-way platforms let you do this such as Mario, Kirby, Smash Bros, etc.
I was able to get the conditional working to see if I was standing on something in the "OneWayPlatform" layer, but I can't figure out how to get my character to fall through it. I tried both IgnoreCollision and IgnoreLayerCollision and neither seemed to do anything. My guess is that this has something to do with the layer mask inside the CharacterController2D script, but I have no idea how that works. I am stumped!
If anyone could explain to me how to do this or point me in the right direction that'd be great!
The text was updated successfully, but these errors were encountered: