So the main problem is very simple but the way i tried to solve it is a bit complicated, it worked but led to other problems. So im gonna explain it step by step what I did.
So first of all the main problem i tried to solve was this. https://www.youtube.com/watch?v=pNeTtEXCwz8
I have animations with root motion enabled. But unless im perfectly aiming the skill the player will just slide off of the enemy. Im trying to replicate the same combat system as Tera, in that game every skill’s animation makes you go forward too, but you dont slide of the enemies like in my example. https://www.youtube.com/watch?v=wYhCumqCchE Example video of Tera’s gameplay
So what I ended up doing is every frame I check if there is an enemy infront of me. if yes I disable root motion if no I enable root motion https://www.youtube.com/watch?v=8QC5of2sF4Q
That solved my first problem but it led to an other problem https://www.youtube.com/watch?v=Ov-vV4usSMQ
I have this animation where it first jump backwards and then forward, since if Im infront of the enemy root motion is disabled the backwards movement isnt applied either from the animation.
What I ended up doing is I made a custom AnimNotifyState called ForceEnableRootMotion, when the state starts it sets a Boolean to true when it ends it sets it to false, When this boolean is true it enables Rootmotion even if there is an enemy infront of me, I added this AnimNotifyState to my montage to the part where its going backwards. So it will always do a backwards jump but when its going forward it will check for enemies again and disable root motion like before https://www.youtube.com/watch?v=xI7jxz1KHIk
This solved that issue but when I got to an other skill it created an other problem.
I also have this animation where it jumps back and Up and than strikes down and forward. The back up part has the custom AnimNotifyState where I force it to apply the root motion even if there is an enemy infront of me. The forward down part doesnt have this NotifyState so it will stop once it actually hits an enemy, but since the root motion is disabled when it hits an enemy it wont apply the Down part of the RootMotion so I will just end up stuck in the air
This is in my AnimationBlueprint and its linked to Event Blueprint Update Animation. https://i.imgur.com/yWwSBtJ.png Is overlapping enemies is true when there is an enemy infront of me Should Stop on Hitting Enemies is set to True when the when a skill is casted and false when the animation ends (Basically just a way for me to create skills that can use root motion regardless if there is an enemy infront of me, for example a roll ability, that wouldnt set this bool to true it would stay false thus keep root motion enabled) Force Enable root motion is set based on my custom AnimNotifyState
My question is simply what should I do ? Is there a way to make it apply the Z axis of the Root Motion only ? Or is there a way better solution for my base problem ? This all started from my character sliding off of enemies so If there is a solution to that problem I could just delete all the bs I made trying to solve it.