Created
May 9, 2019 06:53
-
-
Save GOROman/b12ddb6d4674c61eb826cf3edfc62e54 to your computer and use it in GitHub Desktop.
UnityのSceneView上に行列を表示する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class MatrixViewer : MonoBehaviour | |
{ | |
void Update() | |
{ | |
} | |
void OnDrawGizmos() | |
{ | |
#if UNITY_EDITOR | |
Matrix4x4 m = transform.localToWorldMatrix; | |
string text = ""; | |
text += string.Format("{0:N2} {1:N2} {2:N2} {3:N2}\n", m[0, 0], m[0, 1], m[0, 2], m[0, 3]); | |
text += string.Format("{0:N2} {1:N2} {2:N2} {3:N2}\n", m[1, 0], m[1, 1], m[1, 2], m[1, 3]); | |
text += string.Format("{0:N2} {1:N2} {2:N2} {3:N2}\n", m[2, 0], m[2, 1], m[2, 2], m[2, 3]); | |
text += string.Format("{0:N2} {1:N2} {2:N2} {3:N2}\n", m[3, 0], m[3, 1], m[3, 2], m[3, 3]); | |
UnityEditor.Handles.Label(transform.position, text); | |
#endif | |
} | |
} |
Author
GOROman
commented
May 9, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment