Hello there!
I’m a new unity’s user, and i’m triying to make a little 2D plateformer.
I can controle my player but i have a little problem with my jump.
I made it with a trigger in animator, it works, but i want to stop the animation when player touching the ground.
The best will be to keep the last jump’s frame prep until the player touch the ground, and after stop it.
I have a collider2D on a gameObjet who’s attached to the player with this code:
void OnTriggerEnter2D (Collider2D col)
{
if (col.gameObject.tag == "Sol" || col.gameObject.tag == "Plateforme")
{
transform.parent.GetComponent<playerController>().isGrounded = true;
Audio.pitch = 0.7f;
Audio.volume = 0.7f;
Audio.PlayOneShot(soundGround);
}
}
private void OnTriggerExit2D(Collider2D collision)
{
transform.parent.GetComponent<playerController>().isGrounded = false;
}
I know how to stop boolean, but is it possible with trigger?
Thanks for your help and sorry if my english is bad
Etienne