- Home /
Question by
GitaPradnya · May 11, 2020 at 08:20 AM ·
animatorplayerunity 2d
How to crouch when there is a platform above the character,How to stand crouch when there is a platforn above the character
void Crouch()
{
if(Input.GetButtonDown("Vertical"))
{
state = State.crouching;
}
else if(Input.GetButtonUp("Vertical"))
{
state = State.idle;
}
}
private void VelocityState()
{
if (state == State.jumping)
{
if (rb.velocity.y < .1f)
{
state = State.falling;
}
}
else if (state == State.falling)
{
if (c2d.IsTouchingLayers(ground))
{
state = State.idle;
}
}
else if (state == State.crouching)
{
if (rb.velocity.y == .1f)
{
state = State.crouching;
}
}
else if (Mathf.Abs(rb.velocity.x) > 2f)
{
state = State.running;
}
else
{
state = State.idle;
}
}
,how to script when our character is still crouching when there is a platform above the character?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612233743im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to create and run an animation at runtime? 0 Answers
Virtual Joystick jump in unity2d 0 Answers
Move player on predetermined looping path 1 Answer
I can't record an animation for my player model 0 Answers
Scale animation doubt 0 Answers