- Home /
Question by
hazygames · May 30, 2015 at 05:02 PM ·
movementbugcharactercontrollermove
Problem CC and plane
Hello. I have a problem with the movement on the plane to the vertical position. I get controller.isGrounded is false, the animation plays falling and character falls in one place.
if (controller.isGrounded || fallTimer < 0.5f)
{
getHorizontal = Input.GetAxisRaw("Horizontal");
getVertical = Input.GetAxisRaw("Vertical");
moveDirection = new Vector3(getHorizontal, 0f, getVertical);
moveDirection = Camera.main.transform.TransformDirection(moveDirection);
moveDirection.y = 0f;
moveDirection.Normalize();
moveDirection *= speed;
if (getVertical != 0.0f || getHorizontal != 0.0f)
{
SetState("A_SPRINT");
}
else
{
SetState("A_IDLE");
}
if (Input.GetButtonDown("Jump") && fallTimer < 0.2f)
{
moveDirection.y = 7f;
timer = 0.0f;
SetState("A_STAND_JUMP");
fallTimer = 0.5f;
}
}
else
{
if (fallTimer >= 0.5f && NowState != "A_STAND_JUMP" && NowState != "A_STAND_FALL")
{
SetState("A_STAND_FALL");
}
if (NowState == "A_STAND_JUMP")
{
if (!anim.isPlaying)
{
SetState("A_STAND_FALL");
}
}
}
if (!controller.isGrounded)
{
fallTimer += Time.deltaTime;
}
else
{
if (NowState != "A_STAND_JUMP")
{
fallTimer = 0f;
}
}
How I can get isGrounded true on the plane?
Comment