ramokz / phantom-camera

👻🎥 Control the movement and dynamically tween 2D & 3D cameras. Built for Godot 4. Inspired by Cinemachine.
https://phantom-camera.dev/
MIT License
2.17k stars 71 forks source link

How do I use PhantomCamera with Godot multiplayer? #244

Open warsang opened 6 months ago

warsang commented 6 months ago

Issue description

Hi!

I've been working on using Phantom camera in https://github.com/warsang/Godot-multiplayer ( not mine; forked from https://github.com/thegatesbrowser/godot-multiplayer ).

On my first player/client, the plugin works great. However, on my second client, I don't see a PhantomCameraHost being spawned (I'm guessing that's because there should only be one PhantomCameraHost per scene and therefore, the second one gets removed automatically?). It seems like the second PhantomCameraHost thinks it's in the same scene as the first player? Below is a screenshot of the remote node view with both players/clients spawned and one having a PhantomCameraHost vs the other not having a PhantomCameraHost . I used the same Player scene to spawn both

image

I'm guessing this isn't a bug and I'm just using this wrong for multiplayer set-ups (This is not a P2P multiplayer set-up but a server multiplayer set-up)? Can you provide indications as to how I should go about using PhantomCamera for a multiplayer set-up (or maybe this is just something not supported by the plugin right now and I should be implementing my own Camera controller).

Steps to reproduce

Clone the repo, open project and launch 1 server and two clients. Observe that first client has the PhantomCameraHost node while the other doesn't

(Optional) Minimal reproduction project

No response

ramokz commented 6 months ago

This isn't a bug, but rather a current limitation. Basically, only one PCamHost can exist in a scene at the time. Whenever a second is instantiated, it will automatically be removed from the scene. All the nodes you have there are still part of the same main scene (Root), even though they're nested inside the character sub-scenes.

This is meant to be resolved in #26 in v0.8