Reported this bug about a month ago, it is a new behaviour in 5.1. I’ve been able to reproduce it in a blank scene.
Steps to reproduce:
-Make a character with an AI controller and focus the AI on a moving player. Make sure that you let the character rotate towards the desired rotation in the character BP.
-Add some logic in the character AI to play a montage with root motion as shown in the video. Replicated.
-In the movement component set allow physics rotation while root motion to true.
-Create an actor with a SM as a floor for the characters. Rotate the actor to something different than 0, i.e Z=90.
-Play as a client.
Result:
The AI won’t consider the Ground actor rotation, won’t update the root motion rotation, and will end up teleporting to the authoritative correct location.
Expected:
The AI character will update the rotation and consequent position and won’t teleport when ended since the client and server will be the same.
Notes:
I’ve seen many changes in the movement component diff of 5.1 related to root motion, so might be related. It is a deal breaker if you are using root motion on multiplayer at this moment.
@MayhemMirror Are you using the animations directly?
Seems that the animation needs to have root motion enabled and be converted to an anim montage and then you need to play the montage instead of the pure animation to get root motion to work properly.
Indeed @3dRaven . It is using animation montage + root motion enabled + allow to use physic rotations while root motion.
The issue is happening in the movement component, some changes happened in 5.1 diff. It looks like it loses the delta of the initial rotation on the client and stops updating rotations, which leads to wrong rotation + wrong location, and then the server corrects after.
If the actor underneath doesn’t have additive rotations, root motion with rotation will work as expected on the client.
You can, for example, have the exact same issue replicating using GAS or any other method.
A follow-up. The problem looks worse than what I initially expected. Apparently is not even related to the use of root motion + allowing rotation.
Just a simple root motion will desync server-client when is initiated on top of a rotated actor.
Here you can see 3 cases:
a) AI is on top of a non-rotated actor and uses root motion + rotation.
b) AI is on top of a rotated actor and using root motion + rotation
c) AI is on top of a rotated actor and using root motion with no rotation allowed.
You can see a print text on his head representing the disparity between server and client location (becomes pink when is more than 100 units). The further from the pivot, and the more rotated the floor actor, the higher will be the difference. The delta looks related to the distance between AI and the pivot of the ground actor, aggravated by the ground rotation.
If the AI touched a non-rotated actor, or an SM (that is not an actor), it will sync back, as you can see when I debug close to the border of the square.
Here I am again trying to narrow down the issue.
This new test compares two cases playing as a client.
Root motion is used on top of a rotated actor (grey checker).
Root motion is used on top of a rotated plain SM (green checker).
Beyond all the changes found in the character movement component, many related to Iris replication or root motion
, I think the stamp used when a root motion starts is not fed properly including the rotation of actors.
Funnily enough -not included in the video- rotating just the SM inside the ground grey Actor, leaving the actor in 0, will also fail. In other words, any root or child rotation in any actor will break root motion in multiplayer.
A bit concerned about reporting this bug in November and not seeing it included in the reports.
Let me know if you need a blank scene with the issue ready to be debugged.
Any new updates on this? Or dirty fix suggestions?
My dirty fix suggestion: What about adding a custom replicated vector for position on character blueprint level, updating it with tick on server, on autonomous proxy if distance > allowed, teleport character to the server position. (I don’t mind a few teleports, it’s much better than desync of position for 5-10 seconds which happens in my case).