Setting velocity of RVO doesn't move

Hello, I am trying to move the character using WASD by setting the RVOController.velocity however for some reason the character doesn’t move. Here is the code that I use to set the velocity:

private void Update() { rvoController.velocity = new Vector3(_inputService.Movement.x, 0, _inputService.Movement.y) * movementSpeed; }

I’ve tested the right side and the Vector3 gets correct values. Something interesting that I tried was that I set the DefaultExecutionOrder for this script to one and it is now working for some reason. I’ve checked the execution order from project settings and all seems to be correctly set up.

Enabling and disabling the movement script from inspector also makes it work.

If I start the game with 3 characters instead of one, then it works again. It’s a very weird case.

What might be the reason for this? I am currently on 4.3.77 and Unity 2022.3.5f1 (LTS)

I decided to check things in a new project and it seems like the issue is replicatable. Here are the steps;

  • Create a new project in Unity 2022.3.5f1 using 3D URP template.
  • Add the scoped registry to manigest.json and install A* at 4.3.77.
  • Create an empty object, add Pathfinder and RVOSimulator.
  • In Pathfinder, create a Recast graph and uncheck rasterize meshes. Check rasterize colliders.
  • Create a cylinder, remove capsule collider and AIPath and RVOController. (cylinder won’t be centered but fine for demo purposes.)
  • Create a new script called CharacterMovement. Paste the code below inside;
using Pathfinding.RVO;
using UnityEngine;

public class CharacterMovement : MonoBehaviour
{
    [SerializeField] 
    private float movementSpeed = 3;
    
    [SerializeField] 
    private RVOController rvoController;

    // Update is called once per frame
    private void Update()
    {
        rvoController.velocity = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")) * movementSpeed;
    }
}
  • Attach the script to the cylinder. Make sure to assign the RVOController reference.
  • Start the game and try to move around.

Now, you should’t be able to move around (at least this is what happens my case.) Before stopping the play mode though, try this;

  • Click the cylinder and uncheck the CharacterMovement script. After that, recheck it.
  • Notice how you can move around now.

If you had no problems running around;

  • Try closing the editor and reopening the project. Try to move around again.

Hi

The AIPath will probably try to override whatever you do. You probably don’t want it to run at the same time.

Instead, maybe you want to use code similar to what is on the RVOController documentation page?
Check RVOController - A* Pathfinding Project for some example code.