Commit fd52e284 authored by czy's avatar czy

控制摄像机旋转角度

parent 07371ab7
...@@ -34,8 +34,11 @@ public class FollowTarget : MonoBehaviour ...@@ -34,8 +34,11 @@ public class FollowTarget : MonoBehaviour
public float backDis=5.51f; public float backDis=5.51f;
public float upDis= 8.77f; public float upDis= 8.77f;
//[Tooltip("控制摄像机开始的旋转角度")]
//public Vector3 StartRotation;
[Tooltip("控制摄像机的旋转角度")] [Tooltip("控制摄像机的旋转角度")]
public Vector3 rotationVector3; public Vector3 rotationVector3;
private Vector3 tt;
//public float smood=10; //public float smood=10;
public Transform target; public Transform target;
...@@ -44,13 +47,15 @@ public class FollowTarget : MonoBehaviour ...@@ -44,13 +47,15 @@ public class FollowTarget : MonoBehaviour
{ {
//target = GameObject.FindGameObjectWithTag("Player").transform; //target = GameObject.FindGameObjectWithTag("Player").transform;
//target.position = new Vector3(0,target.position.y,target.position.z);//摄像机不左右看。 //target.position = new Vector3(0,target.position.y,target.position.z);//摄像机不左右看。
//transform.rotation = Quaternion.Euler(StartRotation.x, StartRotation.y, StartRotation.z);
} }
private void LateUpdate() private void LateUpdate()
{ {
rotationVector3 = ConfigurationFile.instance.rotationVector3MainCamera; rotationVector3 = ConfigurationFile.instance.rotationVector3MainCamera;
//读取配置文件数据 //读取配置文件数据
backDis = ConfigurationFile.instance.backDis; backDis = ConfigurationFile.instance.backDis;
upDis = ConfigurationFile.instance.upDis; upDis = ConfigurationFile.instance.upDis;
...@@ -62,8 +67,10 @@ public class FollowTarget : MonoBehaviour ...@@ -62,8 +67,10 @@ public class FollowTarget : MonoBehaviour
Vector3 followPoint = new Vector3(0,0, target.position.z) + Vector3.up * upDis - target.forward * backDis;//照相机不左右移动 Vector3 followPoint = new Vector3(0,0, target.position.z) + Vector3.up * upDis - target.forward * backDis;//照相机不左右移动
transform.position = followPoint; transform.position = followPoint;
//选择 //旋转
//transform.Rotate(RotateVector3); //在update中将会一直旋转 //transform.Rotate(RotateVector3); //在update中将会一直旋转
//Vector3 temp = Vector3.Lerp(transform.rotation.eulerAngles, rotationVector3, 0.01f);
transform.rotation = Quaternion.Euler(rotationVector3.x, rotationVector3.y, rotationVector3.z); transform.rotation = Quaternion.Euler(rotationVector3.x, rotationVector3.y, rotationVector3.z);
......
...@@ -2023,8 +2023,7 @@ Transform: ...@@ -2023,8 +2023,7 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3837569216442705610} m_GameObject: {fileID: 3837569216442705610}
m_LocalRotation: {x: 0.17364818, y: -0.0000000037252903, z: -0.0000000018626451, m_LocalRotation: {x: 0.17364816, y: 0, z: 0, w: 0.9848078}
w: 0.9848078}
m_LocalPosition: {x: 0, y: 7.659995, z: -54.489998} m_LocalPosition: {x: 0, y: 7.659995, z: -54.489998}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
...@@ -2104,7 +2103,8 @@ MonoBehaviour: ...@@ -2104,7 +2103,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
backDis: 6.390015 backDis: 6.390015
upDis: 6.64 upDis: 6.64
RotateVector3: {x: 20, y: 0, z: 0} StartRotation: {x: -29.62, y: 0, z: 0}
rotationVector3: {x: 20, y: 0, z: 0}
target: {fileID: 9066730885846526947} target: {fileID: 9066730885846526947}
--- !u!1 &3837569216639476273 --- !u!1 &3837569216639476273
GameObject: GameObject:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment