Local Avoidance with manual 2D movement

Hi there, I’m trying to get manual movement working with local avoidance. So far I’ve followed the tutorial on the wiki for manual movement, but I can’t get it working with local avoidance. I use: seeker.StartPath(rb.position, knightTransform.position, OnPathCalculated); to get the path.

For the movement I use rigidbody.velocity to move it.
Any help would be appreciated, I can’t find anything on the wiki for this case

When using the AIPath and RVOController components as movement:

  • Using rb.velocity does nothing.
  • Using rb.addforce is a teleport.
  • Using AIPath.Move or RVOController.Move is also a teleport.

The only reason I want my own movement is that I can’t add normal forces like I would normally do.

Hi

Local avoidance will work very poorly with rigidbody.velocity. The local avoidance system really needs to control exactly how the agent moves, otherwise the algorithm cannot properly account for agents’ movement.
It’s possible to emulate forces in a way (e.g. by treating the agent as a point mass, and calculating the velocities yourself), but that requires some custom code since the velocity will need to go through the local avoidance system.

You can find some code for how to use the movement from an RVOController in your custom movement script here: RVOController - A* Pathfinding Project

Hi, I kind of solved it by disabling canMove and then adding force. Then after a certain amount of time I re-enable canMove. It’s not 100% perfect, but I got it to look pretty good and work pretty well.

1 Like