123456789101112131415161718192021222324252627282930313233343536 |
- using UnityEngine;
- using System.Collections;
- namespace Pathfinding.Examples {
- using Pathfinding.RVO;
-
-
-
-
-
-
-
- [RequireComponent(typeof(RVOController))]
- [HelpURL("http://arongranberg.com/astar/documentation/stable/class_pathfinding_1_1_examples_1_1_manual_r_v_o_agent.php")]
- public class ManualRVOAgent : MonoBehaviour {
- RVOController rvo;
- public float speed = 1;
- void Awake () {
- rvo = GetComponent<RVOController>();
- }
- void Update () {
- var x = Input.GetAxis("Horizontal");
- var y = Input.GetAxis("Vertical");
- var v = new Vector3(x, 0, y) * speed;
-
- rvo.velocity = v;
- transform.position += v * Time.deltaTime;
- }
- }
- }
|