- Home /
2 problems with new animation / animator,2 problems with animation
Hi there,
I have a new animation that I want to use in Unity through script (starting with walk -> idle and back). But I have 2 problems, hopefully anyone can push me in the right direction.
Problem 1: My walk-animation only plays one time The following happens: When I start moving (I keep button pushed) the walk-animation plays only one time. But... in my console I see ' true' firing as long as I keep the button pressed. Note: I have disabled exit-time
My script:
public class PlayerMovement : MonoBehaviour { private Animator anim;
private void Awake()
{
anim = GetComponent<Animator>();
}
void Update()
{
var x = Input.GetAxis("Horizontal") * Time.deltaTime; // * 150.0f;
var z = Input.GetAxis("Vertical") * Time.deltaTime; // * 3.0f;
transform.Rotate(0, x, 0);
transform.Translate(0, 0, z);
Animating(x, z);
}
private void Animating(float x, float z)
{
bool walking = x != 0f || z != 0f;
print(walking);
anim.SetBool("IsWalking", walking);
}
}
2: My animation seems to be floating/sliding. - I do have a collider attached, but this collider is above 0-level
Thanks in advance!!
Your answer
Follow this Question
Related Questions
Character Animator controller/movement 1 Answer
Is there a new retargetting system for the animation in 5.5? 1 Answer
How to properly detect the end time of an Animation which wait for the end of the previous one ? 1 Answer
How to add movement to animations? 1 Answer
Help with animator controllers 1 Answer