Hey guys, I’m making a First Person Game and I’m wanting to have an animation that plays when the character rotates on the spot, I’ve written a prototype script, but it doesn’t seem to work, well it kind of does, just the animation plays as soon as the game starts, Does anyone know how to have an animation play when the character rotates on the spot? here is the code that I had written and in the Animator component I’m using a bool paramatter. ( When I mention character rotates on the spot, I’m mentioning how when the player starts looking around with his mouse or mousepad when standing still/Idle.)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AnimationTransitionScript2 : MonoBehaviour
{
Animator animator;
// Start is called before the first frame update
void Start()
{
animator = GetComponentInChildren();
}
// Update is called once per frame
void Update()
{
Input.GetAxis(“Mouse X”);
{
animator.SetBool(“IsRotating”, true);
}
}
}