0 votes
by (8.2k points)
edited by

I am facing issue "Raycast ignores a NavMesh Agent" 

I built a simple game using Unity's built in NavMesh Ageant AI system. My player has a laser that uses a raycast to apply a force to the enemy to not it back. This works... for the first couple seconds of the game. Then, it is as if the NavMesh Agent gets "locked" into movement and is no longer effected by the raycast

1 Answer

0 votes
by (8.2k points)
edited by

Removing the rigidbody, but then that made the navigation work. Changed the Collision Detection on the rigidbody component from 'Discrete', to 'Continuous' instead.

  • Try replacing the BoxCollider on your object with a MeshCollider. This is probably due to mesh sort order; RaycastAll() will also work.
  • Changing from discrete to continuous does not solve the issue. Rigidbody still needs to be removed.
  • Problem occurs when you have both a navmesh agent on the object as well as a rigidbody. Remove the rigidbody and it should work fine.
  • This usually happens when you have both Rigid body and Nav Mesh Agent attached to an object either remove the rigid body component or change the Collision detection from ‘discrete’ to ‘continuous'.
TechXR runs courses in AR / VR / Metaverse / Game Development. Some of the popular Q&A in our courses are available here for easy discovery.

113 questions

117 answers

58 comments

105k users

...