In order to render Weapons in my game, when the Player picks up the Weapon, I spawn the Interpolated Weapon Ghost as a root object in the Scene.
I want to control this Weapon completely client only systems (WorldSystemFlags.ClientSimulation). I’ve disabled syncing LocalTransform by making it IC and DontSerializeVariant on Ghost Inspection component.
On my WeaponRenderSystem, which runs on the PresentationSystemGroup, I use weaponTransform.Value = playerTransform.Value + offset, but this is causing jittering, I can’t figure out why, (I’m assuming GhostField interpolation has something to do with it). Maybe I shouldn’t make these objects Ghost at all. What’s a good solution to this problem?
I assume this weapon is held in the hands of a player? In that case, don‘t sync it. Don‘t even make it a networked object/entity.
My network player simply instantiates or activates pre-instantiated weapon prefabs. The weapon script is on the player, not the weapon. When the player fires, the weapon performs its local-only tasks, eg play sound and fx. Follow the same strategy for any other „parented“ object and you‘ll find many networking challenges simply disappear.
I use NGO but the same principle applies to NfE.
IC should strip LocalTransform from the server, this should work. Without more context it’s a bit hard to tell. If you enable entities journaling, what systems do you see updating your transform client side?
How do you spawn the ghost?
Keep in mind also for any other fields you’re syncing (outside the transform) on that weapon, you’ll be having two timelines interacting together (with the player) instead of one. Your interpolated timeline for the weapon and your predicted timeline for your player. If those need to interact, I’d suggest making the weapon predicted as well.