日記的なもの5日目
using...
MonBehavior
{
private Animator animator;
private const string 対応させたいアニメーション = "対応させたいアニメーション"(何個でもいい)
private float movement = 20f;
private float moveX = 0f;
private float moveZ = 0f;
void Stsrt()
{
this.animator = GetComponent<Animator>();
}
void Update()
{
var cameraForward =
Vector3.Scale(
Camera.main.transform.forward,new Vector3(1,0,1)
).normalized;
var vertical = cameraForward * Input.GetAxis("Vertical");
var horizontal = Camera.main.transform.right *Input.GetAxis
("Horizontal");
var direction = vertical + horizontal;
moveX = direction.x * Time.deltaTime * movement;
moveZ = direction.x * Time.deltaTime * movement;
........