Select all layers in the scene except the triggers
Hi, i'm making a 2D game and i'm finding trouble with the animations and the colliders.
I have a character with some animations attached to it with trees. Idle animations and walking animations. The way i have this coded, i grab the last direction where the player's been looking at and then the trees asign the correct idle and walking animation. The problem with that is when the character encounters a collider, which is when the lastPosition gets buggy and resets to 0. I fixed that making an if statement which doesn't save the lastDirection if encounters a collider.
if (!boxCollider.IsTouchingLayers(Physics2D.AllLayers))
{
lastDirection = rigidbody.velocity;
}
However, this method is giving me trouble with the Triggers. Everytime the character enters a trigger the lastDirection is not recorded and it resets to the last frame's. I can't be able to find a solution to this so if you guys have any ideas, i'll gladly take them.