Last active
August 3, 2016 15:53
-
-
Save tsubaki/280167ea1a84f1eba0282d3dfbdd5a93 to your computer and use it in GitHub Desktop.
経路探索AIを用いてパスを表示する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class TanksLookTarget : MonoBehaviour { | |
[SerializeField] | |
Transform target; | |
[SerializeField] | |
Transform cursor; | |
[SerializeField] | |
NavMeshAgent agent; | |
void Start () | |
{ | |
agent.SetDestination (target.position); | |
agent.updateRotation = false; | |
agent.updatePosition = false; | |
} | |
void Update() | |
{ | |
cursor.rotation = Quaternion.LookRotation (agent.steeringTarget - transform.position, Vector3.right); | |
agent.nextPosition = transform.position; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment