CREATE YOUR WORLD
Players & Characters : Tips
캐릭터가 바닥에 있는지 확인하기
5min
이 가이드에서는 로컬 플레이어의 zepeto 캐릭터가 땅에 있는지 확인하는 방법을 보여줍니다 isgrounded 함수는 unity에서 제공됩니다 📘 charactercontroller isgrounded https //docs unity3d com/scriptreference/charactercontroller isgrounded html https //docs unity3d com/scriptreference/charactercontroller isgrounded html 1단계 스크립트 작성하기 장면에 gameobject를 추가하고 아래의 isgrounded 예제 스크립트를 추가하세요 import { zepetoscriptbehaviour } from 'zepeto script' import { zepetoplayers } from 'zepeto character controller'; import { text } from 'unityengine ui'; export default class isgrounded extends zepetoscriptbehaviour { public mytext text; update() { // 로컬 플레이어의 캐릭터 컨트롤러에 접근합니다 const localcharacter = zepetoplayers instance localplayer zepetoplayer character charactercontroller; // 캐릭터 컨트롤러가 다른 콜라이더에 닿아 있는지 isgrounded를 사용하여 확인합니다 if (localcharacter isgrounded) { this mytext text = "캐릭터가 땅에 있습니다 "; } else { this mytext text = "캐릭터가 땅에 없습니다 "; } } } 2단계 텍스트 ui 설정하기 ui > 텍스트를 장면에 추가합니다 계층 창에서 캔버스 > 텍스트 구성 요소를 zepetoscript 검사기 창에 표시된 속성에 드래그 앤 드롭하여 연결합니다 3단계 실행 재생 버튼을 눌러 실행하면 텍스트 ui를 통해 캐릭터가 바닥에 있는지 확인할 수 있습니다