I'm working on a mechanic to allow the player to dodge through enemies. However I'm running into the issue where the player is only able to dodge through enemies while their already dodging when they collide with the enemy.
I want this to work both ways, as in, when their colliding with the enemy, they should be able to dodge through then.
Here's what I've been trying:
void OnCollisionEnter (Collision col) { // STOP ENEMY FROM MOVING/PUSHING if (col.gameObject.tag == "Enemy") { Debug.Log("Collided with: " + col.gameObject.name); target = col.gameObject; target.GetComponent<ZombieController>().mRigidbody.isKinematic = true; // IGNORE DODGING COLLISION WHEN ALREADY COLLIDED if (isDodging) Physics.IgnoreCollision(col.collider, GetComponent<Collider>(), true); } /* IGNORE DODGING COLLISION if (isDodging && col.gameObject.tag == "Enemy") { Physics.IgnoreCollision(col.collider, GetComponent<Collider>(), true); }*/ } It just doesn't seem to work when the player has already collided with the enemy. Hopefully all that made sense.