How to sync moving platforms

Options
Mochi
Mochi
edited March 2022 in Photon Bolt

Hey, I am using the Kinematic Character Controller asset from Unity and have done this:

1) Instantiate a KinematicCharacterSystem that ticks the simulation (this is done on the server side only).

2) Instantiate a server player and add its motor to the KinematicCharacterSystem.


I managed to sync the player using the provided GetState() and ApplyState() methods just like synching of a player is done in the advanced character tutorial.

Now to the platforms. I have no idea how to sync these. Just like the players they are driven by motors which get added to the KinematicCharacterSystem. So my idea is to simply add the motors to the System (again on the server side only). This naturally makes the platforms move fine for the server player but not for the client player. What else must I do? When synching the player I had the SimulateController() and ExecuteCommand() methods that let me use the GetState() and ApplyState() methods but I do not see how this works for platforms as they will not receive input. Ideally, I want some sort bolt function that works just like ExecuteCommand() so I can get and apply the state of the platform motor on the client side.


Any help is much appreciated! Additionally, do you expect this approach to work well or are there obvious flaws?