Hi, I am trying to implement some simple pathfinding with RVO in a way where I have full control over movement of the agent. Here is some sample code of what I am currently doing to try and achieve this.
//target loc = mouse position Seeker seeker = agent1.GetComponent<Seeker>(); Path p = seeker.StartPath(agent_pos, target_loc); p.BlockUntilCalculated(); List<Vector3> vp = p.vectorPath; int i = 0; while (i < vp.Count && Vector3.Distance(vp[i], agent_pos) < 0.01f) i++; Vector3 next_dest = vp[i]; GetComponent<RVOController>().SetTarget(next_dest, 2f, 2f, new Vector3(float.NaN, float.NaN, float.NaN)); Vector3 delta = controller.CalculateMovementDelta(agent_pos, Time.fixedDeltaTime); GetComponent<Rigidbody>().velocity = delta.normalized * 2.0f;
This works for the most part but there is some stuttering, particularly around corners, where the agent is just rapidly moving in random directions and getting stuck temporarily. I believe this is due to the delay in the RVO calculation or something like that, as it does not seem to occur if I am moving the agent without the RVO delta. Also, increasing the RVOSimulator target frame rate from 20 to 200 does seem to reduce this issue, but not completely.
This is intended to be a multiplayer game. For my purposes, a delay in pathfinding or RVO calculation will not work. I also can’t have the update tied to frame rate, it must happen in every fixed update (which in my case that is exactly 20 times per second). Ideally, I would like to calculate a path for every agent, including the RVO, on every game tick, immediately after all movement inputs have been collected. Is there a way to manually trigger the RVO update or some other way that I can achieve this?