From be581b7c74f7fda11200974c9eb5f1b8b2fa2cdd Mon Sep 17 00:00:00 2001 From: Afeijia Date: Tue, 2 Jul 2024 20:39:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=97=A5=E5=BF=97-20240702-2?= =?UTF-8?q?039=EF=BC=9A=201=E3=80=81=E6=96=B0=E5=A2=9E=E7=9B=B8=E6=9C=BA?= =?UTF-8?q?=E6=BC=AB=E6=B8=B8=E8=A7=92=E5=BA=A6=E7=BA=A6=E6=9D=9F=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/wj/Camera/CameraRoamManager.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/BulkCargo_UnityProject/Assets/Scripts/wj/Camera/CameraRoamManager.cs b/BulkCargo_UnityProject/Assets/Scripts/wj/Camera/CameraRoamManager.cs index 240b0dbf..44311850 100644 --- a/BulkCargo_UnityProject/Assets/Scripts/wj/Camera/CameraRoamManager.cs +++ b/BulkCargo_UnityProject/Assets/Scripts/wj/Camera/CameraRoamManager.cs @@ -64,6 +64,16 @@ public class CameraRoamManager : Singleton /// 漫游速度 /// public float RoamingSpeed = 2; + /// + /// Dopath参数 + /// + [Range(0, 1)] + public float look = 0; + + public bool ConstraintXAxis; + public bool ConstraintYAxis; + public bool ConstraintZAxis; + public Vector3 ConstraintValue; // Start is called before the first frame update void Start() { @@ -78,7 +88,9 @@ public class CameraRoamManager : Singleton m_Position = TargetCamera.position; m_Rotation = TargetCamera.rotation; - TargetCamera.rotation = Quaternion.Euler(m_Rotation.eulerAngles.x, m_Rotation.eulerAngles.y, 0); + TargetCamera.rotation = Quaternion.Euler(ConstraintXAxis ? ConstraintValue.x : m_Rotation.eulerAngles.x, + ConstraintYAxis ? ConstraintValue.y : m_Rotation.eulerAngles.y, + ConstraintZAxis ? ConstraintValue.z : m_Rotation.eulerAngles.z); } } @@ -108,8 +120,7 @@ public class CameraRoamManager : Singleton } } } - [Range(0, 1)] - public float look = 0; + /// /// 执行自动漫游 ///