RVO and Mecanim

I recently bought A Star Pathfinding in the sale after trying out the free version for a while, but I’m having issues implementing RVO with mecanim.

I have a basic scene working with capsules/non-animated models and they are avoiding each other well enough as they attempt to navigate past each other, but I don’t know how to implement the OnAnimatorMove() method in order to achieve the same result as I have with NavMeshAgents in a previous project in order to get a character animating correctly.

Questions:

  1. Which version of RVO is actually the most recent, or rather, which should I be using? I downloaded my version from the asset store yesterday (3.8.6), but I see that the download page on arongranberg.com is now on 3.8.7, and there is also an RVO beta version (3.8.5). Does 3.8.7 include the changes in the RVO beta? Does 3.8.6? Is 3.8.7 the best version to opt for?

  2. In a post by another user I saw a response from Aron saying that you should use RVOController.CalculateMovementDelta in OnAnimatorMove (Help: Root Motion combined with RVO), this function doesn’t appear to exist in my, more recent, version.

Also, a request: could you please add some simple mecanim examples to the asset? Particularly for RVO.

Stupid question maybe, but I keep seeing it… What is RVO?

Reciprocal Velocity Obstacles.

Local avoidance - allows your agents to adjust their speed and direction automatically so they steer around each other and don’t just smack/push into each other if their paths cross.

Gotcha :slight_smile: Is that only in Pro?

Yep, Pro only. Which is the main reason I bought it besides being able to generate graphs at runtime.

Unity’s NavMeshAgents actually have basic local avoidance built in, but it’s apparently not quite as good as A Star’s. However, it seems to be a lot easier to find examples of how to work with Mecanim with the standard Unity NavMesh and NavMeshAgents.

  1. Yeah, the version numbers are a bit messed up right now. Version numbers are really bad at handling beta versions and diverging branches. So 3.8.6/7 are the latest released versions, they contain a few things from the beta, but the betas also include major changes to the system (for example rvo, graph rendering and other things). For the most part 3.8.5 is ahead of 3.8.7 but the 3.8.7 has a few bugfixes that haven’t made it into the beta yet.

You can find the changelog for the 3.8.7 here: http://arongranberg.com/astar/docs/changelog.php
and for 3.8.5 (beta) here: http://arongranberg.com/astar/docs_rvo_fix/changelog.php

  1. It exists in the beta which has the large changes for the RVO system.

Yeah, I should add some mecanim examples. You should be able to use roughly the same approach as in the Unity tutorial here however: https://docs.unity3d.com/Manual/nav-CouplingAnimationAndNavigation.html

I’ve downloaded the latest beta (3.8.5), but I’m struggling to get this to work without the character appearing to be slipping across the screen. I could easily be doing something wrong. I’m using the Standard Assets pack for this test (with the Ethan model, and his animations - though not his animation controller).

I have a basic blend tree with Idle, Walk and Run animations in it. I computed the thresholds by selecting “Speed” from the drop down list in the blend tree. This gave me values of 0, 1.558402 and 5.662317.

I used the code from the AStar documentation and turned off rootmotion on the animator:

public Transform target;
public float speed = 1f;

void Update ()
{
controller.SetTarget(target.position, speed, speed);

Vector3 delta = controller.CalculateMovementDelta(transform.position, Time.deltaTime);
transform.position = transform.position + delta;

animator.SetFloat("Speed", speed);

}

I copied the model with the same animator, but took out all the AStar stuff, and placed it next to the AStar driven one. Gave it a script that set animator.SetFloat(“Speed”, 1) and turned on rootmotion. It walks across the environment without appearing to slip, and walks much more slowly than the AStar driven one.

I’ve only been playing with Unity for about 6 months, and maths is not my strong point (particularly Vector maths), so I could easily be doing something wrong. Is there a difference between the speed value passed in to SetTarget, and the speed value passed in to the animator?

Did you fix this? I’m strucling with the same issue. Getting RVO and Mecanim work together for my NPC’s.

1 Like