Hi,
I have a game where when the player object approaches a server object, it parents to it, so that if that object moves the player also moves. Think standing on a moving platform, sitting in a vehicle seat or moving with the surface of a planet. How can I do this in Unity Netcode multiplayer, where it will work the same for both the host and client?
I wouldn’t do this with parenting, not even in single player.
You have some logic to “know” that the player is on a moving platform. From that point on, the player’s movement is additionally offset by that platform’s movement. To avoid order of execution issues, it’s best to be able to calculate the platform’s current frame movement offset any time it is requested internally or externally.
Player movement on a platform then becomes, in pseudo code:
if (isOnPlatform)
player.transform.position = playerMoveDir + platformMoveDir;