티스토리 뷰

 

코드

// 변수 선언부
 public float GroundedRadius;
 public float GroundedOffset;
 public LayerMask GroundLayers;
 
// 함수 정의부
 void GroundCheck()
 {
 	// 가상의 충돌 구형을 플레이어 위치에 생성한다.
 	Vector3 spherePosition = new Vector3(transform.position.x, 
    				 transform.position.y- GroundOffset,
                     		 transform.position.z);
                             
    	// 가상의 구형의 충돌여부를 검사한다.                        
   	Grounded = Physics.CheckSphere(spherePosition,
   			          GroundRadius,
                                  GroundLayers, 
                                  QueryTriggerInteraction.Ignore);
 }

 

'Unity' 카테고리의 다른 글

AR Foundation을 사용해보자.  (0) 2023.08.27
[Unity] Input System 사용법  (0) 2023.06.26
[Unity] 플레이어 이동 코드  (0) 2023.06.22
[Unity] 플레이어 카메라 회전 기능  (0) 2023.06.18
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
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
글 보관함