목록unity (3)
게임 프로그래밍
[Unity] Scene view -> mousePosition 클릭한 위치 알아내기
1 2 3 4 5 6 void OnSceneGUI() { var mousePosition = Event.current.mousePosition * EditorGUIUtility.pixelsPerPoint; mousePosition.y = Camera.current.pixelHeight - mousePosition.y; Ray ray = Camera.current.ScreenPointToRay(mousePosition); } Colored by Color Scripter cs mousePosition에 EditorGUIUtility.pixelsPerPoint를 곱해주면 된다. 이를 잘 몰라서 조금 고생했다.
프로그래밍/유니티
2020. 3. 12. 10:00
[Unity] 슬로우모션
1 2 3 4 5 public void SetTimeScale(float time) { Time.timeScale = time; Time.fixedDeltaTime = 0.02f * time; } Colored by Color Scripter cs 유니티에서 간단하게 슬로우모션을 할수 있게 만들수 있다. FixedUpdate같은경우에는 1초에 50번씩 고정으로 호출되기 때문에 Time.fixedDeltaTime에 1/50 = 0.02를 곱해주면 더 자연스럽게 된다. 참고로 슬로우모션에 영향을 받고 싶지 않다면 Time 객체중에서 Unscaledtime이라는 것을 쓰면 된다. 코루틴 안에서도 슬로우모션에 영향을 받고 싶지 않다면 RealTime이라는 것이 있을것이다. 그외에도 파티클이나 애니메이션 옵션중에..
프로그래밍/유니티
2020. 3. 4. 23:37