Unity Learn/주니어 프로그래머

6단계 - 조사 및 문제 해결 : How to add force in local

coding-potato 2024. 11. 27. 00:41

발생한 문제 : 차량 회전을 해도 가해지는 힘이 Global기준 임

해결 방안 : 차량의 Local 좌표기준의 앞 방향으로 힘이 가해져야함

검색 키워드 : unity how to add force in local

검색 결과 : 

https://discussions.unity.com/t/addforce-in-local-space/12023

=> Use AddRelativeForce instead of AddForce.

=> AddForce 대신에 AddRelativeForce를 사용하십시오.

 

AddRelativeForce에 대해 검색 :

https://docs.unity3d.com/ScriptReference/Rigidbody.AddRelativeForce.html

 

Unity - Scripting API: Rigidbody.AddRelativeForce

Force can be applied only to an active rigidbody. If a GameObject is inactive, AddRelativeForce has no effect. Wakes up the Rigidbody by default. If the force size is zero then the Rigidbody will not be woken up. For more information on how ForceMode affec

docs.unity3d.com