본문 바로가기
[ Unity ]/- 유니티 실습

유니티 Camera Shake

by MRG 2024. 9. 15.
728x90
반응형

 

 

▣ 스크립트 설명
Update: Input.GetMouseButtonDown(0)을 사용하여 마우스 왼쪽 버튼을 클릭했을 때 카메라 흔들림을 트리거합니다.
Shake: 카메라의 위치를 흔들리게 만드는 코루틴입니다.

Camera.main을 사용해 메인 카메라의 위치를 흔들고, 흔들림이 끝난 후 원래 위치로 복구합니다.
shakeDuration과 shakeMagnitude: 각각 흔들림의 지속 시간과 강도를 조절하는 변수입니다.

 

https://docs.unity3d.com/ScriptReference/Camera-main.html

 

Unity - Scripting API: Camera.main

If there is no enabled Camera component with the "MainCamera" tag, this property is null. Internally, Unity caches all GameObjects with the "MainCamera" tag. When you access this property, Unity returns the first valid result from its cache. Accessing this

docs.unity3d.com

 

https://docs.unity3d.com/ScriptReference/Transform-localPosition.html

 

Unity - Scripting API: Transform.localPosition

Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close

docs.unity3d.com

 

https://docs.unity3d.com/ScriptReference/Camera-main.html

 

Unity - Scripting API: Camera.main

If there is no enabled Camera component with the "MainCamera" tag, this property is null. Internally, Unity caches all GameObjects with the "MainCamera" tag. When you access this property, Unity returns the first valid result from its cache. Accessing this

docs.unity3d.com

 

 

728x90
반응형

댓글