Client-Side Object Rotation Breaks Replication with a Different Network Owner

Recently, I was trying to achieve instant rotation changes by ignoring interpolation. To do this, I first tried rotating the characters on the server, but it looked laggy for the owning client. Then I started rotating the characters on each client, but that broke replication. This also makes it impossible to create 2D logic-based games.

ReplicationIssue.rbxl (57.5 KB)

Expected behavior

I was expecting all characters to rotate without interpolation and without breaking replication.

If you perform the rotation without physics (ie setting the cframe orientaion directly), then there shouldn’t be any interpolation, since there would be no intermediate rotations to interpolate from. Otherwise, your linear motion can remain physical, and other clients will interpolate it and see smooth motion.

If you only change cframe on the client, then its expected to not replicate to others, since its a local only change. Only physical motion will replicate from clients. So you’d need to perform the rotation on the server as well.

1 Like

The part I don’t understand is why simply rotating the character (on client) directly affects position replication so much. In my case, when I make rotation changes to the character from the server, players localcharacters looks like teleporting on their screen at rotation changes.

As far as I know, applying instant rotation changes without directly modifying the orientation is impossible. This, along with replication issues, has pushed me to create a custom character position replication system. I believe this problem is just a bug or a limit for engine’s replication, and the only solution I’ve found is to handle replication manually.

I tried some stuff and got pretty good results by using both an AlignOrientation and flipping the CFrame in script.

I’m using an AlignOrientation with RigidtyEnabled to force the character orientation. This will not disrupt replication and interpolation, and is a better option than setting the CFrame every frame.
But, if you use it to flip the orientation target on the AlignOrientation, you’ll notice that it does take multiple frames to reach the new target, which isn’t what you want.
So, I tried to also manually change the character CFrame whenver I want to flip, and this seems to look pretty good. Want to also give that a try?

I tried, but it still gets interpolated on other clients screens. I also tried changing the character’s CFrame manually with using AlignOrientation, but it’s still gets interpolated for other clients screens. That interpolation on other clients’ screens prevents me from achieving instant horizontal rotation changes in my 2D game.

OK, I think this is the best you will get while trying to use the existing system. While other clients may see a rotation take a couple frames, they otherwise get smooth motion, and your own player character will have instant rotation. You could start trying to have clients flip CFrames of other characters locally - but you’re just approaching a custom replication system at this point.

This is otherwise expected behavior. Writing CFrames directly will override interpolation data, making it stop interpolating, which gives the “laggy” appearance. And local CFrame changes intentionally do not replicate to the server. It sounds like you are anticipating to deviate significantly from the engine defaults (making a 2D game) anyways, so needing to build custom infrastructure to support very specific outcomes is the only option for now. We don’t have any plans to support this in the near future.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.