fix: update pos camera in HP.

This commit is contained in:
Tungdv
2026-01-13 18:34:59 +07:00
parent 8285d1b68a
commit 425698dd79
5 changed files with 65 additions and 10 deletions
@@ -28,13 +28,13 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5860545600847923144}
serializedVersion: 2
m_LocalRotation: {x: 0.23378472, y: -1.6779091e-15, z: 8.341431e-16, w: 0.9722884}
m_LocalRotation: {x: 0.2337847, y: 0, z: 0, w: 0.9722884}
m_LocalPosition: {x: -736.68787, y: 50.89, z: -269.46097}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 27.04, y: 0, z: 0}
--- !u!114 &2923694103221183510
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -164,7 +164,7 @@ MonoBehaviour:
Offset: {x: 0, y: 0}
CenterOnActivate: 1
TargetOffset: {x: 0, y: 1.5, z: 0}
Damping: {x: 0.5, y: 0}
Damping: {x: 0, y: 0}
Lookahead:
Enabled: 0
Time: 0
@@ -53,10 +53,20 @@ namespace BrewMonster
//todo: should not always update
if (_cinemachineCamera.Follow == null && CECGameRun.Instance.GetHostPlayer() != null)
{
_cinemachineCamera.Follow = CECGameRun.Instance.GetHostPlayer().transform;
_cinemachineCamera.ForceCameraPosition(CECGameRun.Instance.GetHostPlayer().transform.position, Quaternion.identity);
orbital.HorizontalAxis.Value = 208;
orbital.VerticalAxis.Value = -268;
if(CECGameRun.Instance.GetHostPlayer().PointCam != null)
{
_cinemachineCamera.Follow = CECGameRun.Instance.GetHostPlayer().PointCam;
_cinemachineCamera.ForceCameraPosition(CECGameRun.Instance.GetHostPlayer().PointCam.position, Quaternion.identity);
orbital.HorizontalAxis.Value = 208;
orbital.VerticalAxis.Value = -268;
}
else
{
_cinemachineCamera.Follow = CECGameRun.Instance.GetHostPlayer().transform;
_cinemachineCamera.ForceCameraPosition(CECGameRun.Instance.GetHostPlayer().transform.position, Quaternion.identity);
orbital.HorizontalAxis.Value = 208;
orbital.VerticalAxis.Value = -268;
}
}
}
}
@@ -28,6 +28,7 @@ namespace BrewMonster
{
[SerializeField] protected Transform parentModel;
[SerializeField] protected TextMeshProUGUI txtName;
[SerializeField] protected Transform pointCam;
[ResetStatic]
private static PLAYER_ACTION[] _default_actions;
[ResetStatic]
@@ -181,7 +182,10 @@ namespace BrewMonster
{
parentModel = transform.GetChild(0);
txtName = GetComponentInChildren<TextMeshProUGUI>();
if(transform.childCount >= 3)
{
pointCam = transform.GetChild(2);
}
_pPlayerModel = await NPCManager.Instance.GetModelPlayer(profession, gender);
Scene scene = SceneManager.GetActiveScene();
SceneManager.MoveGameObjectToScene(_pPlayerModel, scene);
+35 -2
View File
@@ -103,7 +103,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3356314488807061436}
m_LocalRotation: {x: 0.15124027, y: 0.8467184, z: 0.39120576, w: -0.3273416}
m_LocalRotation: {x: -3.7702125e-16, y: 0.97228837, z: 0.23378475, w: 1.5679955e-15}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -194,6 +194,37 @@ MonoBehaviour:
m_EditorClassIdentifier:
targetCamera: {fileID: 0}
mode: 1
--- !u!1 &3780435110686298972
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1700647273248867791}
m_Layer: 3
m_Name: PointCam
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1700647273248867791
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3780435110686298972}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5695237227048099898}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &5505736060713067023
GameObject:
m_ObjectHideFlags: 0
@@ -298,7 +329,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6417286913550183034}
m_LocalRotation: {x: 0.15189841, y: -0.86322004, z: -0.37099996, w: 0.30681783}
m_LocalRotation: {x: 0.15068072, y: -0.80287755, z: -0.16731258, w: 0.5519869}
m_LocalPosition: {x: 0, y: 0, z: -0.19}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -456,6 +487,7 @@ Transform:
m_Children:
- {fileID: 78581589932911603}
- {fileID: 8793437051475293945}
- {fileID: 1700647273248867791}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!143 &2967440448469171042
@@ -503,6 +535,7 @@ MonoBehaviour:
_animationList: []
isHit: 0
id: 0
isDebug: 0
--- !u!1 &7854944069823046156
GameObject:
m_ObjectHideFlags: 0
+8
View File
@@ -170,6 +170,8 @@ namespace BrewMonster
public EC_Inventory EquipInventory => m_equipInventory;
public EC_Inventory TaskInventory => m_taskInventory;
public Transform PointCam { get => pointCam; }
private void OnApplicationQuit()
{
if (m_pTaskInterface != null)
@@ -361,6 +363,12 @@ namespace BrewMonster
{
return;
}
// Always set the pointCam's world rotation value to Vector3.zero
// because rotating the character with the camera will cause a lagging effect.
if(pointCam != null)
{
pointCam.rotation = Quaternion.identity;
}
#if UNITY_EDITOR
if (Input.GetKeyDown(KeyCode.C))
{