- Home /
Question by
iTzYZex · Jan 05, 2017 at 06:53 AM ·
c#navmeshagent
My characther turning the wrong way when walking using Nav Mesh Agent
so when i press a place on the map it begins turning around ex. https://gyazo.com/db6a060b9ee4c785b95f8e54137a2a68 i tried to move the parent empty object object dont work and suggestions and here is my code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
public UnityEngine.AI.NavMeshAgent agent;
void Start()
{
agent = GetComponent<UnityEngine.AI.NavMeshAgent>();
}
void Update()
{
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100))
{
agent.destination = hit.point;
}
}
}
}
Comment