3-5) Creating The Platform Falling Effect

시그니천·2024년 6월 5일

[ G01 ] ZigZagRacer

목록 보기
13/26

1.Platform

  • 스크립트작성
public class Platform : MonoBehaviour
{
    private void OnCollisionExit(Collision collision)
    {
        if(collision.gameObject.tag == "Player")
        {
            Invoke("Fall", 0.2f);
        }
    }
    private void Fall()
    {
        this.GetComponent<Rigidbody>().isKinematic = false;
        Destroy(gameObject, 1f);
    }
}
  • Prefab에다 붙여주기

2. Tag 설정

  • player tag 설정
profile
우주최강개발자

0개의 댓글