A* Pathfinding Character Rotation

atmuc

Member
When I use Astar AI Agent Movement ability, It does not change character's rotation related to path. When I use Navmesh Agent Movement ability it works.

How can I fix this?
 
When I disable use root motion rotation, it works. When using root motion rotation it does not rotate.
 
In the included A* demo scene when I disable root motion the character still rotates with the path. Have you tried comparing your settings to the settings in the demo scene?
 
I tried demo scene. it is the same. I wrote it does not work when enable root motion. you wrote it works when you disable root motion. please enable both root motion position and rotation.

I created an empty project. I imported UCC and AStar.

I use
Unity 2022.2.14
UCC 3.0.9
AStar 4.2.18
Latest AStar integration (downloaded yesterday)

Root motion enabled; When I play, Character does not move.

1681459163626.png

Root motion disabled;
1681459230949.png
 
I mistyped on the root motion aspect. For me it works the same with root motion enabled versus disabled.

My guess is that you are seeing the smoothing applied by the A* component. I am not sure how you can get it to follow the path exactly as A* will gently move the character in the target direction. You can see the values returned by A* by drawing a vector to the m_NextPosition within the Update method of the A* ability.
 
My problem is not following the exact root or smooth path. Character does not move when root motion enabled in the demo scene :)

What is your Unity version?
 
In demo scene, Even I select Adventure movement type, it performs Combat movement. Can this be the problem?

1681476877716.png
1681476908421.png
 
Is that a fresh project? I am using Unity 2021.3.0 with A* 4.2.18 and version 3.0.9 of the character controller.

Even I select Adventure movement type, it performs Combat movement. Can this be the problem?
No, that's the same for me.
 

Attachments

  • 1681462486169.png
    1681462486169.png
    426 KB · Views: 5
Disabled is the default in that demo scene so I am in the habit of changing it. Here's the correct screenshot:

1681499630393.png

The results are the same for me. You can start to debug this by watching the DesiredMovement value within CharacterLocomotion.ApplyPosition. This value indicates where the character should move to. If it's 0 then something is blocking the character from moving. The DesiredMovement value is set by the A* ability so that's also a good place to start.
 
Please read my previous messages :) I wrote twice, please enable both root motion position and rotation. When they are disabled, it works for me too. I want to use root motion position and rotation with A Star navigation. I hope this time you will see what I see :) Please check my video for settings. I showed both enabled and disabled with mouse cursor.
 
Ohh, sorry about that. This is the expected behavior. With root motion enabled it relies on the animations to rotate the character. Since we don't have any rotation animations within the animator for this setup the character will not be able to rotate. I will look to see why the navmesh version rotates but I am surprised that it does. I wouldn't have expected it to - it's probably ignoring the root motion rotation setting so you'll get the same effect as if root motion rotation is disabled.

I'm glad that we are now on the same track :)
 
We have rotation animations in Adventure movement type. Yaw parameter does not look fine. pathfinding supply delta rotation. Is delta rotation not enough to calculate yaw?
 
The yaw angle is calculated from the desired rotation. I realize that there is a circular dependency though in that the desired rotation can only be determined from the animation when using root motion rotation. For non-root motion it makes sense though because the animation is following the movement rather than determining the movement. I'll think about it for the next update.
 
Top