文章分类 - Unity
摘要:U_3D数学基础 Dot 点乘 两个向量的点积。 点积是一个浮点值等于两个向量的大小相乘再乘以它们之间夹角的余弦值。 对于标准化向量点返回1,如果它们指向完全相同的方向,如果它们指向完全相反的方向,点返回-1,如果向量垂直,点返回0。 Cross 叉乘 两个向量的外积。 两个向量的外积会得到第三个向
阅读全文
摘要:[Serializable] public struct CrossData { public Image CrossImage; public Transform CrossCurrentTransform; public Transform CrossDefaultTransform; }
阅读全文
摘要:Unity WheelCollider 轮子碰撞体 //同步 wheelCollider 位置和旋转值至 Mesh 所在 Transform wheelCollider.GetWorldPose(out pos, out rot); wheelTransform.rotation = rot; wh
阅读全文
摘要:A 制作菜单工具 [MenuItem("Assets/生成配置")] public static void Create() { Debug.Log("生成配置"); } B 资源聚焦 EditorUtility.FocusProjectWindow(); // 聚焦 Selection.activ
阅读全文
摘要:A 旋转 绕某轴旋转一定角度,顺时针逆时针 Unity Tips: How to rotate a Vector by an angle? (youtube.com)
阅读全文
摘要:A Gizmod 颜色添加 1 private void OnDrawGizmos() { 2 if (null != enemy) { 3 Gizmos.color = Color.red; 4 Gizmos.DrawLine(transform.position, enemy.position)
阅读全文
摘要:A 根据物体的 forward 方向位移。 1 transform.position = Vector3.Lerp(transform.position, transform.position + transform.forward, Time.deltaTime); B 根据世界坐标 Forwar
阅读全文