Character camera and movement fix - maybe

This commit is contained in:
2025-10-12 13:27:37 +02:00
parent 0f716ab4a7
commit 78836c0691
6 changed files with 191 additions and 12 deletions

View File

@@ -268,6 +268,12 @@ namespace MegaKoop.Game.Networking
}
}
var controller = clone.GetComponent<ThirdPersonCharacterController>();
if (!info.IsLocal && controller != null)
{
controller.SetCameraTransform(null);
}
// Ensure only the local player's camera remains active and is MainCamera
if (info.IsLocal)
{
@@ -297,7 +303,6 @@ namespace MegaKoop.Game.Networking
}
// 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);
@@ -306,6 +311,11 @@ namespace MegaKoop.Game.Networking
controller.SetCameraTransform(camTransform);
}
}
if (inputSender != null && thirdPersonCamera != null)
{
inputSender.SetCameraTransform(thirdPersonCamera.transform);
}
}
}