카메라 설정 변경

45도 y:18 z:-18 로 설정
z축만 follow하는 컨트롤러도 사용해봤으나 별로여서 코드만 남겨둠.
This commit is contained in:
2026-02-01 14:36:02 +09:00
parent 4e852b9da6
commit 7927dab72f
5 changed files with 154 additions and 101 deletions

View File

@@ -59,6 +59,7 @@
<Compile Include="Assets\Scripts\TeamType.cs" />
<Compile Include="Assets\Scripts\CoreResourceManager.cs" />
<Compile Include="Assets\Scripts\Building.cs" />
<Compile Include="Assets\Scripts\SimpleCameraZFollow.cs" />
<Compile Include="Assets\Scripts\GameResourceUI.cs" />
<Compile Include="Assets\Scripts\FogOfWarRenderer.cs" />
<Compile Include="Assets\Scripts\ResourcePickup.cs" />
@@ -86,6 +87,7 @@
<Compile Include="Assets\InputSystem_Actions.cs" />
<Compile Include="Assets\FlatKit\Demos\[Demo] Desert\Scripts\BillboardLineRendererCircle.cs" />
<Compile Include="Assets\Scripts\BuildingHealthBar.cs" />
<Compile Include="Assets\Scripts\CameraZFollow.cs" />
<Compile Include="Assets\Scripts\PlayerSpawnPoint.cs" />
<Compile Include="Assets\FlatKit\Demos\Common\Scripts\AutoLoadPipelineAsset.cs" />
<Compile Include="Assets\Scripts\AutoHost.cs" />

View File

@@ -149,7 +149,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 519420032}
- {fileID: 1672828973}
- {fileID: 1290143990}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &306979656
@@ -596,7 +596,7 @@ Camera:
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 45
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
@@ -622,8 +622,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 519420028}
serializedVersion: 2
m_LocalRotation: {x: 0.38268343, y: 0, z: 0, w: 0.92387956}
m_LocalPosition: {x: 0, y: 31, z: -25}
m_LocalRotation: {x: 0.38268346, y: -0.00000022436977, z: 0.000000092937015, w: 0.92387956}
m_LocalPosition: {x: 0, y: 19, z: -18}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -1633,6 +1633,101 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1290143989
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1290143990}
- component: {fileID: 1290143993}
- component: {fileID: 1290143992}
m_Layer: 0
m_Name: CinemachineCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1290143990
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1290143989}
serializedVersion: 2
m_LocalRotation: {x: 0.38268343, y: -0.00000022436976, z: 0.00000009293699, w: 0.92387956}
m_LocalPosition: {x: 0, y: 19, z: -18}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 61373299}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1290143992
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1290143989}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineFollow
TrackerSettings:
BindingMode: 4
PositionDamping: {x: 1, y: 1, z: 1}
AngularDampingMode: 0
RotationDamping: {x: 1, y: 1, z: 1}
QuaternionDamping: 1
FollowOffset: {x: 0, y: 18, z: -18}
--- !u!114 &1290143993
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1290143989}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineCamera
Priority:
Enabled: 0
m_Value: 0
OutputChannel: 1
StandbyUpdate: 2
m_StreamingVersion: 20241001
m_LegacyPriority: 0
Target:
TrackingTarget: {fileID: 5887522270574905679, guid: 6c700f44a7d74e141a002e9484d2057c, type: 3}
LookAtTarget: {fileID: 0}
CustomLookAtTarget: 0
Lens:
FieldOfView: 60
OrthographicSize: 5
NearClipPlane: 0.3
FarClipPlane: 1000
Dutch: 0
ModeOverride: 0
PhysicalProperties:
GateFit: 2
SensorSize: {x: 21.946, y: 16.002}
LensShift: {x: 0, y: 0}
FocusDistance: 10
Iso: 200
ShutterSpeed: 0.005
Aperture: 16
BladeCount: 5
Curvature: {x: 2, y: 11}
BarrelClipping: 0.25
Anamorphism: 0
BlendHint: 0
--- !u!1 &1433142230
GameObject:
m_ObjectHideFlags: 0
@@ -1733,7 +1828,7 @@ MonoBehaviour:
m_DisconnectTimeoutMS: 30000
ConnectionData:
Address: 127.0.0.1
Port: 7834
Port: 7802
ServerListenAddress: 127.0.0.1
ClientBindPort: 0
DebugSimulator:
@@ -1987,101 +2082,6 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1672828972
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1672828973}
- component: {fileID: 1672828975}
- component: {fileID: 1672828974}
m_Layer: 0
m_Name: CinemachineCamera
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1672828973
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1672828972}
serializedVersion: 2
m_LocalRotation: {x: 0.38268343, y: 0, z: 0, w: 0.92387956}
m_LocalPosition: {x: 0, y: 31, z: -25}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 61373299}
m_LocalEulerAnglesHint: {x: 45, y: 0, z: 0}
--- !u!114 &1672828974
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1672828972}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b617507da6d07e749b7efdb34e1173e1, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineFollow
TrackerSettings:
BindingMode: 4
PositionDamping: {x: 1, y: 1, z: 1}
AngularDampingMode: 0
RotationDamping: {x: 1, y: 1, z: 1}
QuaternionDamping: 1
FollowOffset: {x: 0, y: 30, z: -25}
--- !u!114 &1672828975
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1672828972}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f9dfa5b682dcd46bda6128250e975f58, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.Cinemachine::Unity.Cinemachine.CinemachineCamera
Priority:
Enabled: 0
m_Value: 0
OutputChannel: 1
StandbyUpdate: 2
m_StreamingVersion: 20241001
m_LegacyPriority: 0
Target:
TrackingTarget: {fileID: 5887522270574905679, guid: 6c700f44a7d74e141a002e9484d2057c, type: 3}
LookAtTarget: {fileID: 0}
CustomLookAtTarget: 0
Lens:
FieldOfView: 45
OrthographicSize: 5
NearClipPlane: 0.3
FarClipPlane: 1000
Dutch: 0
ModeOverride: 0
PhysicalProperties:
GateFit: 2
SensorSize: {x: 21.946, y: 16.002}
LensShift: {x: 0, y: 0}
FocusDistance: 10
Iso: 200
ShutterSpeed: 0.005
Aperture: 16
BladeCount: 5
Curvature: {x: 2, y: 11}
BarrelClipping: 0.25
Anamorphism: 0
BlendHint: 0
--- !u!1 &1701756764
GameObject:
m_ObjectHideFlags: 0

View File

@@ -0,0 +1,49 @@
using UnityEngine;
public class SimpleCameraZFollow : MonoBehaviour
{
[Header("Camera Settings")]
[SerializeField] private float fixedXPosition = 0f;
[SerializeField] private float fixedYPosition = 10f;
[SerializeField] private float zOffset = -10f;
[SerializeField] private float smoothSpeed = 5f;
[SerializeField] private bool lockRotation = true;
private Transform target;
private void Start()
{
FindPlayerTarget();
}
private void FindPlayerTarget()
{
var players = FindObjectsByType<NetworkPlayerController>(FindObjectsSortMode.None);
foreach (var player in players)
{
if (player.IsOwner)
{
target = player.transform;
Debug.Log($"<color=green>[Camera] Target found: {player.name}</color>");
return;
}
}
Invoke(nameof(FindPlayerTarget), 0.5f);
}
private void LateUpdate()
{
if (target == null) return;
Vector3 targetPos = target.position;
Vector3 desiredPosition = new Vector3(fixedXPosition, fixedYPosition, targetPos.z + zOffset);
transform.position = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed * Time.deltaTime);
if (!lockRotation)
{
transform.LookAt(target);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b3f3be10d36619c4f8bc25eeb8a91829

View File

@@ -21,6 +21,6 @@ Step 4: Excel등에서 csv파일의 데이터 입력/수정
Step 5: Unity 에디터 상단의 Northbound 탭 => Data Importer 메뉴 실행
Step 6: Unity ScriptableObject(프리팹, 애셋) 생성 (자동)
Step 6: Unity ScriptableObject(프리팹, 애셋) 및 사용 가능한 프리팹 자동 생성
Step 7: 수정한 csv 파일과 생성된 SO 파일을 모두 commit & push