http://blog.csdn.net/liujunjie612/article/details/45847877 我们接着上一篇博文继续研究摄像机,这篇我们说下Unity中摄像机的切换,说到切换,前提是有多个 摄像机,所以我们新建二个摄像机. 我们再创建一个空物体挂上我们新建的脚本CameraSwitch,用来控制摄像机的切换 代码如下: using UnityEngine; using System.Collections; public class CameraSwitch : Mono
当初弄不明白旋转..居然找不到资料四元数应该用轴角相乘...后来自己摸明白了 通过两种旋转的配合,可以告别世界空间和本地空间矩阵转换了,大大提升效率. 每个轴相乘即可,可以任意轴,无限乘.无万向节锁问题 四元数旋转: using UnityEngine; using System.Collections; public class RotationTest : MonoBehaviour { public float x, y, z; void Start () { } void Update
方式一:将摄像机直接拖到游戏对象的下面: 方式二:脚本实现 using System.Collections; using System.Collections.Generic; using UnityEngine; public class kow : MonoBehaviour { public Transform targetTr; public float dist = 10.0F; public float height = 3.0F; public float dampTrace =
using UnityEngine; using System.Collections; public class Triangle : MonoBehaviour { public float speed = 90; // Update is called once per frame void Update () { transform.Rotate(Vector3.forward*Time.deltaTime*speed); } public void ChangeSpeed(float