当初弄不明白旋转..居然找不到资料四元数应该用轴角相乘...后来自己摸明白了 通过两种旋转的配合,可以告别世界空间和本地空间矩阵转换了,大大提升效率. 每个轴相乘即可,可以任意轴,无限乘.无万向节锁问题 四元数旋转: using UnityEngine; using System.Collections; public class RotationTest : MonoBehaviour { public float x, y, z; void Start () { } void Update
正如unity api文档所说: Transforms position from local space to world space. 即Transform.TransformPoint是将局部坐标点转化到世界空间(而不是父空间). 至于如何 高效 地将局部空间坐标转到父空间,还没找到. 在论坛发了个帖子:http://answers.unity3d.com/questions/936166/how-to-transform-from-local-space-to-parent-space.
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