Rotation from z to 90 degrees when falling to the ground 2D design

Asked

Viewed 21 times

0

I’m pretty clueless on the subject, but I’m learning how to program. To make my platform game more cool I enabled the character’s rotation, but I want to make a way that when falling and touching the ground it already goes back to 90 degrees again, only I have difficulties to do this Note: I’ve already made a way that he identifies that is touching the ground

void OnCollisionEnter2D(Collision2D collision)
{
    if(collision.gameObject.layer == 8)
    {
        IsJumping = false;
    }
}
void OnCollisionExit2D(Collision2D collision)
{
  if(collision.gameObject.layer == 8)
    {
        IsJumping = true;
    }   
}

1 answer

1

When the character’s Gameobject touches the ground, use:

transform.eulerAngles = new Vector3(0, 0, 90);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.