相机轨道优化
This commit is contained in:
parent
05139fc47b
commit
e3fafac79c
|
@ -43,11 +43,27 @@ public class CameraMgr : MonoSingleton<CameraMgr>
|
|||
{
|
||||
camera_Rt.SetTarget(viewTarget, _distance);
|
||||
}
|
||||
|
||||
public void GotoView(Transform viewTarget, float _distance,Quaternion rotation)
|
||||
{
|
||||
camera_Rt.SetTarget(viewTarget, _distance,rotation);
|
||||
}
|
||||
|
||||
public void GotoView(Vector3 viewTarget, float _distance)
|
||||
{
|
||||
camera_Rt.SetTarget(viewTarget, _distance);
|
||||
}
|
||||
|
||||
public void StoreTarget()
|
||||
{
|
||||
camera_Rt.StoreTarget();
|
||||
}
|
||||
|
||||
public void ResumeView()
|
||||
{
|
||||
camera_Rt.ResumeTarget();
|
||||
}
|
||||
|
||||
public void ReturnToMain()
|
||||
{
|
||||
Camera.main.transform.DORotate(originRot, 1);
|
||||
|
|
|
@ -8,6 +8,8 @@ using UnityEngine.EventSystems;
|
|||
using DG.Tweening;
|
||||
using System;
|
||||
using static WebInteraction;
|
||||
using static UnityEngine.GraphicsBuffer;
|
||||
using Unity.VisualScripting;
|
||||
|
||||
/// <summary>
|
||||
/// 相机控制
|
||||
|
@ -200,6 +202,10 @@ public class CameraRT : MonoBehaviour
|
|||
DOTween.To(() => target.eulerAngles, v => target.eulerAngles = v, new Vector3(0, 110, 0), 0.5f).OnComplete(() => { auto_move = false; });
|
||||
}
|
||||
|
||||
public Vector3 resume_position;
|
||||
public float resume_distance;
|
||||
public Quaternion resume_rotation;
|
||||
|
||||
public void SetTarget(Transform _target)
|
||||
{
|
||||
target.position = _target.position;
|
||||
|
@ -219,6 +225,16 @@ public class CameraRT : MonoBehaviour
|
|||
x = _target.eulerAngles.y;
|
||||
}
|
||||
|
||||
public void SetTarget(Transform _target, float _distance, Quaternion rotation)
|
||||
{
|
||||
target.position = _target.position;
|
||||
distance = _distance;
|
||||
cameraTransform.rotation = rotation;
|
||||
|
||||
y = cameraTransform.eulerAngles.x;
|
||||
x = cameraTransform.eulerAngles.y;
|
||||
}
|
||||
|
||||
public void SetTarget(Vector3 _target, float _distance)
|
||||
{
|
||||
target.position = _target;
|
||||
|
@ -228,6 +244,23 @@ public class CameraRT : MonoBehaviour
|
|||
//x = _target.eulerAngles.y;
|
||||
}
|
||||
|
||||
public void StoreTarget()
|
||||
{
|
||||
resume_position = target.position;
|
||||
resume_distance = distance;
|
||||
resume_rotation = cameraTransform.rotation;
|
||||
}
|
||||
|
||||
public void ResumeTarget()
|
||||
{
|
||||
target.position = resume_position;
|
||||
distance = resume_distance;
|
||||
cameraTransform.rotation = resume_rotation;
|
||||
|
||||
y = cameraTransform.eulerAngles.x;
|
||||
x = cameraTransform.eulerAngles.y;
|
||||
}
|
||||
|
||||
Vector3 oldMousePos;
|
||||
void Update()
|
||||
{
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue