- Home /
Question by
scottiesoreal · May 10, 2021 at 09:22 AM ·
2d gamecollider2dconditional
Conditional colliders based on input.,Is there a way to make a collider conditional based on input?
I'm making a 2D (maybe 2.5D as I progress) game where my character needs to be able to, on command, walk through walls. So, say I walk up to a building, normal colliders apply, but say I press the space bar, my character now ignores that collider and can step through. Any suggestions? If you need any more context than that, ask away.
Comment
Answer by DrJBN · May 10, 2021 at 10:03 AM
Get a reference to the collider and disable it with if (whateverkey) Collider.enabled = false;