/// <summary> /// 画LocalCube /// </summary> /// <param name="transform"></param> /// <param name="offset"></param> /// <param name="size"></param> /// <param name="color"></param> public static void GizmosLocalCube(Transform transform, Vector3 offset, Vector3 size, Color color) { if (!Is_Gizmos_Enable) { return; } using (new GizmosColorScope(color)) { var cube = new Cube3D(Vector3.zero, Vector3.one); cube.MultiplyMatrix(Matrix4x4.TRS(offset, Quaternion.identity, size)); cube.PreMultiplyMatrix(transform.localToWorldMatrix); cube.GetDrawLineList().ForEach(kv => { GizmosLine(kv.Key, kv.Value, color); }); } }
/// <summary> /// 画LocalCube /// </summary> /// <param name="matrix"></param> /// <param name="offset"></param> /// <param name="size"></param> /// <param name="color"></param> public static void HandlesLocalCube(Matrix4x4 matrix, Vector3 offset, Vector3 size, Color color) { if (!Is_Handles_Enable) { return; } using (new HandlesColorScope(color)) { var cube = new Cube3D(Vector3.zero, Vector3.one); cube.MultiplyMatrix(Matrix4x4.TRS(offset, Quaternion.identity, size)); cube.PreMultiplyMatrix(matrix); cube.GetDrawLineList().ForEach(kv => { HandlesLine(kv.Key, kv.Value, color); }); } }
/// <summary> /// 画LocalCube /// </summary> /// <param name="matrix"></param> /// <param name="offset"></param> /// <param name="size"></param> /// <param name="color"></param> /// <param name="duration">持续时间</param> /// <param name="isDepthTest"></param> public static void DebugLocalCube(Matrix4x4 matrix, Vector3 offset, Vector3 size, Color color, float duration = 0, bool isDepthTest = true) { if (!Is_Debug_Enable) { return; } var cube = new Cube3D(Vector3.zero, Vector3.one); cube.MultiplyMatrix(Matrix4x4.TRS(offset, Quaternion.identity, size)); cube.PreMultiplyMatrix(matrix); cube.GetDrawLineList().ForEach(kv => { DebugLine(kv.Key, kv.Value, color, duration, isDepthTest); }); }