Hello,
I have my player character animated model (downloaded from Mixamo, with roll forward animation).
I am able to play the roll animation whenever space key is pressed using trigger parameter.
Here is my code
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
private Animator anim;
private Rigidbody rb;
// Start is called before the first frame update
void Start()
{
anim = GetComponent<Animator>();
rb = GetComponent<Rigidbody>();
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
anim.SetTrigger("Roll");
}
}
But, right after the animation is placed, my player comes back to it’s original position.
(I know, its because I am just playing the animation and not changing its transform).
But how do I change it’s transform, so that the player actually appears to be rolling forward.