1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DrawGizmoTest : MonoBehaviour {
public Color color;
private void OnDrawGizmos()
{
float x = transform.lossyScale.x/2;
float y = transform.lossyScale.y/2;
float z = transform.lossyScale.z/2;
Gizmos.color = color;
// +x to -x
Gizmos.DrawRay(new Vector3(x, y, z), (Vector3.left * transform.lossyScale.x));
Gizmos.DrawRay(new Vector3(x, y, -z), (Vector3.left * transform.lossyScale.x));
Gizmos.DrawRay(new Vector3(x, -y, z), (Vector3.left * transform.lossyScale.x));
Gizmos.DrawRay(new Vector3(x, -y, -z), (Vector3.left * transform.lossyScale.x));
// +y to -y
Gizmos.DrawRay(new Vector3(x, y, z), (Vector3.down * transform.lossyScale.y));
Gizmos.DrawRay(new Vector3(x, y, -z), (Vector3.down * transform.lossyScale.y));
Gizmos.DrawRay(new Vector3(-x, y, z), (Vector3.down * transform.lossyScale.y));
Gizmos.DrawRay(new Vector3(-x, y, -z), (Vector3.down * transform.lossyScale.y));
// +z to -z
Gizmos.DrawRay(new Vector3(x, y, z), (Vector3.back * transform.lossyScale.z));
Gizmos.DrawRay(new Vector3(x, -y, z), (Vector3.back * transform.lossyScale.z));
Gizmos.DrawRay(new Vector3(-x, y, z), (Vector3.back * transform.lossyScale.z));
Gizmos.DrawRay(new Vector3(-x, -y, z), (Vector3.back * transform.lossyScale.z));
}
}
| cs |
댓글
댓글 쓰기