Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When setting the transform.position, it breaks the pathfinding. #38

Closed
miyucomics opened this issue Feb 2, 2021 · 1 comment
Closed
Assignees
Labels
question Further information is requested

Comments

@miyucomics
Copy link

miyucomics commented Feb 2, 2021

I am using NavMeshPlus to guide a wizard enemy towards the player. It works great except when he teleports. To teleport, he sets his transform.position to his destination. This causes the pathfinding to malfunction, though.

I am not sure if this is related but if the wizard collides with a Rigidbody2D, he fixes himself. The Wizard also has a Rigidbody2D and BoxCollider2D.

@h8man
Copy link
Owner

h8man commented Feb 2, 2021

Hello @BrianComics,

NavMeshPlus is only responsible for creating NavMeshSurface, which is a standard Unity component, and doesn't involved in pathfinding.
But:

  1. Physics and NavMeshAgent does not mix very well
    Here is the guide to follow https://docs.unity3d.com/Manual/nav-MixingComponents.html
  2. Use Agent.Warp(transform.position) on teleportation.

@h8man h8man self-assigned this Feb 2, 2021
@h8man h8man added the question Further information is requested label Feb 2, 2021
@h8man h8man closed this as completed Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants