Trying a multiplayer game with characters with is own camera

Like here, we first ask if we are the owner and only then ask for input and move the player

Like for example in the awake method ?

by user 632418299711324161

Ohhhh okey

by user 632418299711324161

Yes, but in start not awake.

Awake is called right when the object is instantiated/created and the owner property of PlayerState might not be populated yet. Start is happening a frame later where the PlayerState is populated.

Okey. Thanks again @kipash :cactus: . I will try it.

by user 632418299711324161

:slightly_smiling_face:

by user 632418299711324161

Thanks for you time .

by user 632418299711324161

Glad to help​:+1: let me know if anything wouldn’t be clear :cactus:

Yeah, sure.

by user 632418299711324161

Hi again :slightly_smiling_face:

by user 632418299711324161

I did and it works, It spawn a player for each window browser but they can’t move :sweat_smile:
I did this in the ThirdPersonController :
image.png

by user 632418299711324161

Those are the last lines of the start method

by user 632418299711324161

player state will be always true. It’s a component, what you want to do is to ask if the isLocalPlayer is true.

Which is a boolean property on the PlayerState class.

Okey. One question, the root object of player needs to have SyncTranform ?

by user 632418299711324161

Yes :+1: the object that you want to move. It maybe the root, it maybe the PJ. Depends on what object the ThirdPersonController is moving with.

Thanks.

by user 632418299711324161

When I open a new browser window a new player spawns. But when I check two windows at the same time It seems that they are not syncronized because the position of one player doesnt change respect the another window. Also, when I open a new window and spaws a new player , in that windwo I can see both players but when I want to move, i move both player.The same behavior occurs in new windows.

by user 632418299711324161

hm, can you send me your ThirdPersonController.ts? You can just drag and drop the file here, it will make a nice preview.

Yep

by user 632418299711324161

Controllers.ts

by user 632418299711324161