Start : 2025/02/21 16:11 ~ 2025/02/21 18:40B16 00:00 ~ B16 32:50

⇒ Player Jump와 Jump Animation, 그리고 RaycastHit2D 클래스를 사용하여 지면과의 충돌 조사

물리 점프

Player Jump Script

PlayerMove.cs

using UnityEngine;

public class PlayerMove : MonoBehaviour
{
		...
	  public float jumpPower;
		...
		void Update()
		{
				...
				// 플레이어 점프
				if (Input.GetButtonDown("Jump"))
						rigid.AddForce(Vector2.up * jumpPower, ForceMode2D.Impulse);
				...
		}	
		...
}

실행 화면

01_Player Jump.mp4

중력 값 설정

image.png

IsTrigger

02_Coins_IsTriggerCheck.mp4

Animation