Problem with Unity animator controller priority against scripts
When making the enemies ai and workng on the player movment, the animations were having problems with the actual movment, where directly modifying the model's position or velocity while playing the animation can cause the models look like they are sliding, which is not good for player's visual experience.
After doing some researches and testing, I found a solution for the problem. When importing a human-like model, I turn on the humanoid animation type, and create avatar for the animations, and then I can click on "Apply Root Motion" option in the animator controller. With that the model only moves when the animation moves.
But there are also some problems coming with that. The first one is that some times the animation is having a Y axis movment or probably rotations that can cause unexpected movment, a simple solution to that is to bake the unwanted movment in to pose by clicking the "Bake Into Pose" option in the animation clips. Another problem is sometimes I want my model to be able to do a jump attack or a rolling movement regardless of the animation, but the animator has higher proirity over the scripts so that any force applied on it will be overwritten by the animator. The solution I used for that is in the scipt, when start doing movements, I turn off the apply to root motion option on the animator, and when the animation finished or a timer has reached, I turn the apply to root motion back so that the animator regain the control of the movement.
Author: Zeyuan Song
Posted on 03/22/2024
Get Suits of the Abyss
Suits of the Abyss
Status | In development |
Author | AstralArchitects |
Genre | Action, Platformer |
Tags | Roguelike |
More posts
- Carrying player data between scenes in Unity (Pt.3, The Finale)May 04, 2024
- Player ground detection issueMay 02, 2024
- URP sprite shader issueApr 27, 2024
- Carrying player data between scenes in Unity (Pt.2)Apr 27, 2024
- Weapon Effects and AnimationsApr 27, 2024
- Resolution issuesApr 27, 2024
- Minimap and fog of warApr 20, 2024
- Player WeaponsApr 20, 2024
- Carrying player data between scenes in UnityApr 13, 2024
- Poker Hand DetectionApr 13, 2024
Leave a comment
Log in with itch.io to leave a comment.