Replicated rotations are mapped to 0-360 on client but -180-180 on server.

I am replicating a rotation for my aim offset inside my character blueprint. client side angle is remapped from -180-180 to 0-360. Here are some screenshots of blueprint that creates variable and client and server side output.


Hi Haha71687,

I haven’t been able to reproduce this using information you’ve shown. Which version of engine are you using? Are you able to reproduce this in a new project, or does it only happen in your current project? If you can put together a small test project in which this happens, please upload it somewhere and send me a download link. Otherwise, be as explicit as possible in recounting steps you took to create it. Thanks!

I successfully reproduced bug in 4.7 preview 5 by creating a new first person blueprint and adding this to character blueprint.


Here is output from print statements showing discrepency between client and server versions of rotator variables.

Hey Haha71687,

Thanks for screenshots! I was able to reproduce this in 4.7.5, and I’ve entered a bug report (UE-9488). I’ll let you know when I see an update. Thanks!

This is happening because rotator delta node normalizes angles to range -180 to 180 before returning, but when we compress rotators for network serialization, we convert them to 0 to 360 range. Both of these ranges can describe a complete circle, and should be equivalent in practice. Is this causing a specific artifact in your project?

UPDATE: I got around this by adjusting mathematically in animation blueprint if animation was local or remote…attaching screenshot. Why these values wouldn’t be replicated as they were sent to server…I don’t know that just rubs me raw because it’s not obvious and it’s very frustrating. Now, if rotation goes above 180, I subtract 360 from it to “normalize” it, otherwise I pass rotation untouched because it’s below 180.

I could have fixed this by changing my code to deal in 0-360 degrees instead, but it’s principle that something should work on client as it does across network…

This exact issue has been causing me biggest pain. I swear. My aimoffsets are based -180 to 180.

server prints out rotator’s value from -180 to 180 just fine, but AimOffset only “registers” from 0 to 180 then thing’s just looking backwards whole time from -180 to 0. Works fine on client side of course.

Do I need to remap my aim offset from 0-360 and adjust my math?

Just found this post after running into exact same thing today. I get that they’re “same” angle, but I definitely agree. Consistency would be nice. Replication is hard enough to wrangle without mini wrenches like this being thrown into works.

I encountered this problem myself, and after some frustration trying to math it out conditionally on “is locally controlled” I discovered a much cleaner answer: the “Normalize Axis” node. It ensures that angle is on the [-180, 180] domain.

327926-screenshot-2021-01-23-180640.png

2 Likes