멀티플레이어 카메라 대응
카메라 각도 변경
This commit is contained in:
@@ -3265,11 +3265,11 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5356928211000044894, guid: 2b08dd32e48ef5e4aa65a6122099152e, type: 3}
|
- target: {fileID: 5356928211000044894, guid: 2b08dd32e48ef5e4aa65a6122099152e, type: 3}
|
||||||
propertyPath: FollowOffset.y
|
propertyPath: FollowOffset.y
|
||||||
value: 3
|
value: 5
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5356928211000044894, guid: 2b08dd32e48ef5e4aa65a6122099152e, type: 3}
|
- target: {fileID: 5356928211000044894, guid: 2b08dd32e48ef5e4aa65a6122099152e, type: 3}
|
||||||
propertyPath: FollowOffset.z
|
propertyPath: FollowOffset.z
|
||||||
value: -20
|
value: -10
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
using Unity.Netcode;
|
using Unity.Netcode;
|
||||||
using Unity.Netcode.Components;
|
using Unity.Netcode.Components;
|
||||||
|
using Unity.Cinemachine;
|
||||||
|
|
||||||
[RequireComponent(typeof(NetworkObject))]
|
[RequireComponent(typeof(NetworkObject))]
|
||||||
public class PlayerNetworkController : NetworkBehaviour
|
public class PlayerNetworkController : NetworkBehaviour
|
||||||
@@ -40,6 +41,18 @@ public class PlayerNetworkController : NetworkBehaviour
|
|||||||
{
|
{
|
||||||
if (!IsOwner) return;
|
if (!IsOwner) return;
|
||||||
|
|
||||||
|
// 1. 씬에 있는 가상 카메라를 찾습니다.
|
||||||
|
// Unity 6에서는 CinemachineVirtualCamera 대신 CinemachineCamera를 주로 사용합니다.
|
||||||
|
var vcam = GameObject.FindAnyObjectByType<CinemachineCamera>();
|
||||||
|
|
||||||
|
if (vcam != null)
|
||||||
|
{
|
||||||
|
// 2. 카메라의 Follow와 LookAt 대상을 '나'로 설정합니다.
|
||||||
|
vcam.Follow = transform;
|
||||||
|
vcam.LookAt = transform;
|
||||||
|
Debug.Log("<color=green>[Camera] 로컬 플레이어에게 카메라가 연결되었습니다.</color>");
|
||||||
|
}
|
||||||
|
|
||||||
_inputActions = new PlayerInputActions();
|
_inputActions = new PlayerInputActions();
|
||||||
_inputActions.Player.Jump.performed += ctx => OnJump();
|
_inputActions.Player.Jump.performed += ctx => OnJump();
|
||||||
_inputActions.Player.Attack.performed += ctx => OnAttackServerRpc();
|
_inputActions.Player.Attack.performed += ctx => OnAttackServerRpc();
|
||||||
|
|||||||
Reference in New Issue
Block a user