Fix ?
This commit is contained in:
@@ -268,6 +268,46 @@ namespace MegaKoop.Game.Networking
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure only the local player's camera remains active and is MainCamera
|
||||
if (info.IsLocal)
|
||||
{
|
||||
foreach (var cam in cameras)
|
||||
{
|
||||
cam.tag = "MainCamera";
|
||||
cam.enabled = true;
|
||||
cam.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
// Disable any other active cameras that are not part of this player
|
||||
foreach (var otherCam in UnityEngine.Object.FindObjectsOfType<Camera>())
|
||||
{
|
||||
if (!otherCam.transform.IsChildOf(clone.transform))
|
||||
{
|
||||
otherCam.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure there is exactly one enabled AudioListener (on this player)
|
||||
foreach (var otherListener in UnityEngine.Object.FindObjectsOfType<AudioListener>())
|
||||
{
|
||||
if (!otherListener.transform.IsChildOf(clone.transform))
|
||||
{
|
||||
otherListener.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Bind the character controller to this camera for input-relative movement
|
||||
var controller = clone.GetComponent<ThirdPersonCharacterController>();
|
||||
if (controller != null)
|
||||
{
|
||||
Transform camTransform = thirdPersonCamera != null ? thirdPersonCamera.transform : (Camera.main != null ? Camera.main.transform : null);
|
||||
if (camTransform != null)
|
||||
{
|
||||
controller.SetCameraTransform(camTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static string BuildPlayerName(LobbyPlayerInfo info, int index)
|
||||
|
||||
@@ -76,6 +76,11 @@ namespace MegaKoop.Game
|
||||
inputSource = source;
|
||||
}
|
||||
|
||||
public void SetCameraTransform(Transform cam)
|
||||
{
|
||||
cameraTransform = cam;
|
||||
}
|
||||
|
||||
private Vector2 ReadMovementInput()
|
||||
{
|
||||
if (inputSource != null)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user