일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 게시판
- 출처 : https://webdir.tistory.com/506
- toString
- object
- https://velog.io/@velopert/create-typescript-react-component
- http://jeonghwan-kim.github.io/dev/2019/06/25/react-ts.html
- 출처 : https://joshua1988.github.io/web-development/javascript/promise-for-beginners/
Archives
- Today
- Total
Back Ground
Unity - OnDrawGizmos 기즈모 그리기 본문
기즈모(Gizmo)
기즈모는 Scene에서 게임 오브젝트와 관련된 그래픽인데
시각적 디버깅을 위해서 사용되고, 설정된 기즈모는 뷰에 보이게 된다.
[ Gizmo 함수 ]
1 2 3 4 5 6 7 |
void OnDrawGizmos() { } void OnDrawGizomosSelected() { } |
cs |
OnDrawGizmos()
Unity에서 런타임 시 실행되는 기즈모를 그릴 수 있는 함수이다.
선택할 수 있고 항상 화면에 나타나는 기즈모(gizmos)를 그리고 싶은 경우에 OnDrawGizmos를 사용한다.
씬(scene)에서 중요한 오브젝트를 빠르게 선택하는 경우에 매우 유용
OnDrawGizmos는 씬 뷰와 상대적인 마우스 위치를 사용한다는 점을 주의
OnDrawGizmosSelected()
Unity에서 런타임 시 오브젝트를 선택할때 기즈모를 그릴 수 있는 함수이다.
[ 기즈모 속성 ]
1 2 3 4 5 6 7 8 |
void OnDrawGizmos() { Gizmos.color = Color.red; Gizmos.DrawCube(transform.position, Vector3.one); Gizmos.DrawSphere(transform.position, 1f); Gizmos.DrawMesh(mesh, transform.position); } Colored by Color Scripter |
cs |
[ 기즈모 문서 ]
https://docs.unity3d.com/kr/530/ScriptReference/Gizmos.html
Gizmos.color | 기즈모 색 변경 |
Gizmos.DrawLine(Vector3 from, Vector3 to) | 선 형태의 기즈모. /from/에서 /to/로 향하는 라인을 그립니다. |
Gizmos.DrawCube(Vector3 center, Vector3 size) | 큐브 형태의 기즈모. /center/와 /size/를 가지는 박스를 그립니다. |
Gizmos.DrawSphere(Vector3 center, float radius) | 구 형태의 기즈모. |
Gizmos.DrawMesh(Mesh mesh) | 메쉬 모양의 기즈모 오버로드된 함수가 많음. |
Gizmos.DrawIcon(Vector3 center, string name) | 이미지 파일을 기즈모로.. name 은 파일 이름을 쓰면된다. Assets/Gizmos/ 안의 이미지 파일을 사용하며 icon.png 등 확장자 포함해서 스트링값을 넣어주면 됨. ex) Gizmos.DrawIcon(transform.position, "icon.png"); 그외에 선, 레이 프러스텀 등이 있고 와이어만 보여지는 기즈모도 있다. |
'Unity > 3D' 카테고리의 다른 글
Unity - Mathf.Cos(), Mathf.Sin() 시야함수 만들기 (0) | 2021.07.25 |
---|
Comments