Signed-off-by: TRAfoer <lhf190@outlook.com>

This commit is contained in:
2025-07-13 20:47:43 +08:00
parent c49d68de9c
commit 81ac6de8dc
11 changed files with 19477 additions and 17474 deletions

View File

@@ -15,7 +15,7 @@ namespace Ichni.RhythmGame
{
public partial class GameCamera : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule
{
[FormerlySerializedAs("camera")]
[FormerlySerializedAs("camera")]
public Camera gameCamera;
public Transform rotationPoint;
public Transform positionPoint;
@@ -93,18 +93,24 @@ namespace Ichni.RhythmGame
public partial class GameCamera
{
private void LateUpdate() // 处理LookAt
public void UpdateLookAt(LookAt lookAt) // 处理LookAt
{
if (transformSubmodule?.lookAt is not null &&
transformSubmodule.eulerAnglesOffsetLock &&
if (
transformSubmodule.eulerAnglesOffsetLock &&
transformSubmodule.eulerAnglesDirtyMark)
{
Vector3 lookingDirection = (lookAt.lookAtObject.transform.position - transform.position).normalized;
Vector3 eulerAnglesOffse = Quaternion.LookRotation(lookingDirection).eulerAngles;
transformSubmodule.eulerAnglesOffset.Add(eulerAnglesOffse);
Vector3 offset = transformSubmodule.eulerAnglesOffset.Sum();
transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + offset;
transform.LookAt(transformSubmodule.lookAt.lookAtObject.transform);
transform.localEulerAngles += transformSubmodule.currentEulerAngles;
// transform.LookAt(transformSubmodule.lookAt.lookAtObject.transform);
transform.localEulerAngles = transformSubmodule.currentEulerAngles;
transformSubmodule.eulerAnglesDirtyMark = false;
transformSubmodule.eulerAnglesOffset.Clear();
}
@@ -120,7 +126,7 @@ namespace Ichni.RhythmGame
}
bool willRefresh = false;
if (!transformSubmodule.eulerAnglesOffsetLock && transformSubmodule.eulerAnglesDirtyMark)
{
Vector3 offset = transformSubmodule.eulerAnglesOffset.Sum();
@@ -145,7 +151,7 @@ namespace Ichni.RhythmGame
{
Refresh();
}
}).AddTo(gameObject);
}
}