Root Motion issues

Hi,

First off all im a newb :slight_smile:

I have an animator containing three animations. They are not linked by transition.

Im using the richAI script, with RVO controller and im using local avoidance to prevent overlapping.
This works fine, however root motion and the richAI controller is making the movement looks like they slide when they walk.

Any idea how i can make root motion control the movement to make it look smoother?

Also im using this together with ICE Creature Control.

Anyone? :slight_smile:

I am also looking for this and everything I have found so far is not really working, because it’s for older versions of the plugin.

People say that this works - How do you push a character in a direction but stay in the navmesh like NavMeshAgent.Move()?

But I cant call MovementUpdate like in the example. One more thing is that I never saw the OnAnimatorMove method in the posts I have read.

Really? I tried with like 15 versions now. In the older ones it works, but in those, with root motions on local avoidance fail. The agents overlap each other :frowning :frowning:

Extremely frustrating, been spending 1 week straight on this now !

I am not using local avoidance for now only rich ai, but there is a script called MecanimBridge in the latest version, I have been trying to get it working for the past 1 hour without a success. Maybe take a look and it may work in your case, because I am not using humanoid characters just Generic rigs.

Thanks for the suggestion, but i tried that also, unfortunaly im no expert. But i have tried to modify the script in so many ways, using try and fail method basically.

I used animator and tried to use variables in the mecanimbridge file in the animator setup. But i cannot even get a connection for some reason. Starting to think its a integration issue with ICE. Seems like ICE integration script still connects to the RVO Controller as an actuall Character controller.

I figured it out! Finaly. I had to edit the integration script from ice creature control in 2 different sections. If anyone need help with this let me know.

Can you post the root motion code and is it using a humanoid character or not? Also do you handle the rotation with root motion or not?

Your using ICE right? Becuase all i did was to modify the adapter script in a few sections to depend on IAstarAI instead of RVOController.
It does seem like A* is handling rotation.
But im using root motion, and sliding effect is gone. Using humanoid with a animatorcontroller.

It does look ALOT better.

No I don’t have the ICE asset

Hi

Sorry for the late answer, these last few days have been very busy for me.
Using root motion and local avoidance is unfortunately quite tricky. The reason is that those two paradigms work against each other to a large part. Root motion restricts the ways that the character can move to only those possible using animations and local avoidance wants to be able to move the character in any way it wants to be able to avoid collisions.
Personally I would recommend using either root motion or local avoidance, but not both. I know that might be a disappointing answer, but I haven’t found nice and stable way to unify them both.
One approach that may work for you is to separate the position of the agent from the position of the rendered agent. If you set ai.updatePosition/ai.updateRotation to false the agent will not longer be synced with the Transform position/rotation. Then you can use root motion to somehow approximate if movement of the agent, and if it gets too far away then you can bypass root motion a bit and move it towards the right spot. This is not something that I have currently implemented in the package however.

Currently I have a script called ‘MecanimBridge’ for using mecanim with this package, however unfortunately I have no example of this in the package yet. The reason is that it has been hard to find a 3D character and animations that I can distribute with this package (there are some Unity built-ins, but they are usually missing one or two animations that I want), most do not allow it because of licensing issues. Right now I’m considering just hiring an animator to make some custom animations that I can distribute in order to get some examples.
I’m sorry that there aren’t any good examples of root motion with this package at the moment.

@juststan
For an up to date example of some similar code, check this section in the documentation: https://arongranberg.com/astar/docs/iastarai.html#MovementUpdate

Also I cannot really speak for the ICE integration as it is not I who maintain it, it is the ICE developers.

The most important thing for me was to remove the slide effect, and make local avoidance work. I pointed some of the movement variables in a* towards Ice movements, in an integration script. Making Ice handle the movement, which is set to root motion. Setting A* variables = Ice movement variables. And it seems to work well so far… really well actually.
Root motion is on, no sliding effects, local avoidance works etc. However, A* still seem to control the rotation, but thats fine.

Oh, nice that you managed to get it working so nicely :slight_smile:

I am wondering why in this example (and many others) the code is executed in Update instead of OnAnimatorMove? Also by " Modify nextPosition and nextRotation in any way you wish" do you mean setting the nextPosition = animator.rootPosition as we’re doing without using this package. My rootmotion code without A* looks like this:

    private void OnAnimatorMove()
    {
        if (Time.deltaTime <= 0 || !Context.UpdateMovement) return;

        Vector3 position = Context.Animator.rootPosition;
        position.y = Context.Agent.nextPosition.y;
        transform.position = position;
    }

I also have code inside Update that’s the same as the unity’s tutorial “Coupling animation and navigation”

What about using the standard assets ethan character/animations?

Last time I checked I think the standard assets didn’t contain the animations I wanted for making it work well.

Hey Daniel, any chance you could give some details about which ICE variables you pointed towards A*? Any info about how you made your solution work would be great! I’m not using ICE, but am running into a similar issue – if you could PM me your ICE integration script it would probably help me out a lot though!