- Home /
This question was
closed Dec 14, 2016 at 06:04 AM by
weitay for the following reason:
Fixed in later version of Unity
Question by
weitay · Oct 28, 2016 at 07:39 AM ·
navmeshagentnavigationobstacle
NavMeshAgent.velocity does not work with carved obstacle
Hi,
I have a player who is a navmesh agent who is controlled by the keyboard. The following script is for the player
public class Player : MonoBehaviour {
NavMeshAgent myNavMeshAgent;
void Awake()
{
myNavMeshAgent = GetComponent<NavMeshAgent>();
}
void FixedUpdate()
{
float v = Input.GetAxisRaw("Vertical");
float h = Input.GetAxisRaw("Horizontal");
Vector3 walkVector;
float walkSpeed = 6f;
//Move position
walkVector = new Vector3(h, 0f, v);
walkVector = walkVector.normalized * walkSpeed;
myNavMeshAgent.velocity = walkVector;
}
}
This works fine but the moment I add a NavMesh Obstacle with carve set to true the player refuses to move! At first I thought it was because the player also has a rigidbody but when I removed that it still dosen't move!
Comment