OnAnimatorMove but on abilities?

Juneav

Member
Hello there! Hope you are fine!
I am trying to create some really smooth animations using an ability implementing root motion, both position and rotation.
In my ability I am setting the use root motion position and rotation to false, because I want to implement it by code and tweak it only at certain frames of the current animation, in raw tutorials (classic scripting, not using opsive) this is done in the OnAnimatorMove method, but I dont see that in the ability lifecycle, so which of these would be? is it separated on UpdateRotation/ApllyRotation and UpdatePosition/ApplyPosition?
Thanks!
Sin título.png
 
Hi, if you want root motion to be enabled or disabled during specific frame ranges, can’t you just use animation events ? More specifically you can listen to them using Animation Event Triggers, and activate/deactivate a state that sets root motion. If you’re not familiar with UCC’s State System please catch up on it by looking at this doc page.

Lastly I can’t check directly at the moment, but if my memory is correct the AnimatorMonitor component - on the character model object, the one with the animator - contains the OnAnimatorMove function.

Hope this helps !
 
Hi, if you want root motion to be enabled or disabled during specific frame ranges, can’t you just use animation events ? More specifically you can listen to them using Animation Event Triggers, and activate/deactivate a state that sets root motion. If you’re not familiar with UCC’s State System please catch up on it by looking at this doc page.

Lastly I can’t check directly at the moment, but if my memory is correct the AnimatorMonitor component - on the character model object, the one with the animator - contains the OnAnimatorMove function.

Hope this helps !
Hi! Thanks for your response!
Unfortunatelly, my use case cannot make use of animation events or states :( this is because I really need to apply my own root motion position and rotation in OnAnimatorMove (think of this as if I were using target matching).
And yes, the OnAnimatorMove is on the animator monitor, but I was wondering if there is something like that for abilities?
 
Now that I think of it, if I want to completely override both position and rotation with my own calcs, where in the ability lifecycle should I do that in a way that it does not conflict with anything else (like the animator if using root motion)?
I need to progressively rotate the character in a direction from -180 to 180 while an animation with root motion position is playing...
 
Last edited:
If you want to rely on both OnAnimatorMove and abilities, I think it should be possible to send an event in AnimatorMonitor.OnAnimatorMove, and register that event in AbilityStarted and unregister it in AbilityStopped.

As to where to override position and rotation in the ability, my first guess would be in the ApplyRotation and ApplyPosition overrides, maybe you can get the current root motion data in there and add to it your own modifications. Due to hardware issues I currently can't take a closer look at it on my side, but if you're interested in looking at this in depth together I can offer one screenshare for free. In any case I hope this is helpful !
 
If you want to rely on both OnAnimatorMove and abilities, I think it should be possible to send an event in AnimatorMonitor.OnAnimatorMove, and register that event in AbilityStarted and unregister it in AbilityStopped.

As to where to override position and rotation in the ability, my first guess would be in the ApplyRotation and ApplyPosition overrides, maybe you can get the current root motion data in there and add to it your own modifications. Due to hardware issues I currently can't take a closer look at it on my side, but if you're interested in looking at this in depth together I can offer one screenshare for free. In any case I hope this is helpful !
I see...
Actually I do have the root motion data from the animations i am playing, all i need to know is how to use them with m_Character.DesiredRotation (or the best way to apply rotation) using an angle, something like m_Character.DesiredRotation = "Quaternion magic to rotate the character using a Y angle"; and that's gonna be it!
 
Thanks @Cheo!

m_Character.DesiredRotation = "Quaternion magic to rotate the character using a Y angle"; and that's gonna be it!
You can use Quaternion.Euler if you have the y angle, and then take the difference with the existing rotation.
 
Alright! Thanks for this! But bear with me just a little, if I want smoothly (or even instantly) rotate the character let's say 90 degrees (turn right) or -180 degrees (turn completely to the left) what is the exact code I need to use? I'm am rotating towards an angle not an object, and where should I do this? On normal Update or in ApplyRotation ? Sorry to be asking this but I get weird results every time :(
Thanks for the help!
 
Hi, if you want to instantly set the rotation then that makes things simpler as you can just use UltimateCharacterLocomotion.SetRotation. It can actually be used for rotation over time, you can call it every frame feeding it a step variable for Y. I still can't try it for myself but would at first glance recommend ApplyRotation to make sure no other rotation is applied after your own. Lastly what exactly do you mean by weird results ? Feel free to share a video recording of your setup and results, and the offer for a screenshare still stands.
 
Back
Top