アニメーションを使った回転

using UnityEngine;

public class RotateSpeed : MonoBehaviour
{
    Animator animator;
    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            animator.SetFloat("Speed", 0.5f);
            return;
        }
        if (Input.GetMouseButton(1))
        {
            animator.SetFloat("Speed", 2.0f);
            return;
        }
        animator.SetFloat("Speed", 1f);
    }
}

Unity,小技

Posted by hidepon