I'm trying to implement multiplayer shooting with the help of rays. Usually, when the player presses the fire button, I launch a ray from the center of the camera in the current direction. But now, I do not understand how to do that in a multiplayer environment.
There is only one camera in the scene, when a player joins this one who owns it locally. When a player draws, I cast a ray in the local instance and give the result to the host using a "Command" function that deals damage to the corresponding player. Respawn in my case means resetting the health and position on a "network start position". Now, I realized that when a player gets shot and dies / respawn, there is a slight lag and if the player who shot at him has a quick gun, he will apply damage, even He is already dead, because in his local case, the position has not yet been updated properly. It's only 1 or 2 shots but that's too much.
So, I changed it when a player shoots, he does not run a radius but calls a "Command" function to launch a radius on the host, but only realized on the # Host, remote players do not have a camera.
Now I am stuck. If I connect a camera to each prefab and activate them at startup only for the local drive, I can not use it either because they are disabled on the host.
My current attempt is simply to move position and lookdirection to the "Command" function while getting the same results.
So, how should I proceed here? I've also tried different QoS settings with the same result.