Cardboard and Navmesh: Problem with Player Movement
Hi guys, i have a problem in my script. The idea of my game is make the player walk only on determined "Walkpoints". But when i click on my Walkpoint, the player goes directly to the last Walkpoint that have on the scene. What i have to do to player go on the order that i want? Already, grateful
My script:
[RequireComponent(typeof(Collider))]
public class Move : MonoBehaviour{ //IGvrGazeResponder {
private Vector3 goal;
public NavMeshAgent agent;
public GameObject cursor;
private GameObject wp;
void Start()
{
agent = GetComponent<NavMeshAgent> ();
wp = GameObject.FindGameObjectWithTag("WalkPoint");
goal = wp.transform.position;
}
public void PlayerMove()
{
goal = cursor.transform.position;
MoveToDestination ();
}
public void MoveToDestination()
{
agent.destination = goal;
Debug.Log ("Move");
}
#region IGvrGazeResponder implementation
public void OnGazeTrigger()
{
PlayerMove();
}
#endregion
}
Comment
Your answer
Follow this Question
Related Questions
Navmesh based player movement 1 Answer
[Help] Player stops moving when hitting wall diagonally 0 Answers
Hit a wall in my RTS movement controller. Issues with MoveToward and Coroutine logic. 0 Answers
Calculate max velocity.magnitude 0 Answers
Continuous movement with waypoint systems, and NavMesh agent 0 Answers