Locomotion Starter Kit


----motion script---

using UnityEngine;

using System.Collections;

public class motion : MonoBehaviour

{

private Animator anim;

void Start()

{

anim = GetComponent<Animator>();

}

void Update()

{

if (Input.GetKey("up"))

{

anim.SetBool("Walk", true);

}

else

{

anim.SetBool("Walk", false);

}

}

}


--idoのスクリプト--

using UnityEngine;

using System.Collections;

public class ido : MonoBehaviour

{

public float speed = 3.0f;

// Update is called once per frame

void Update()

{

if (Input.GetKey("up"))

{

transform.position += transform.forward * speed * Time.deltaTime;

}

if (Input.GetKey("down"))

{

transform.position -= transform.forward * speed * Time.deltaTime;

}

if (Input.GetKey("right"))

{

transform.position += transform.right * speed * Time.deltaTime;

}

if (Input.GetKey("left"))

{

transform.position -= transform.right * speed * Time.deltaTime;

}

}

}





一番役立ったのが

あもらのなかブログ

中のひとはいません。