CREATE YOUR WORLD
Players & Characters: Tips
Checking if a character is on the ground
5 min
in this guide, we will show you how to check if the local player's zepeto character is on the ground based on the isgrounded function provided by unity 📘 charactercontroller isgrounded https //docs unity3d com/scriptreference/charactercontroller isgrounded html https //docs unity3d com/scriptreference/charactercontroller isgrounded html step 1 write a script add a gameobject to the scene and add the isgrounded example script below 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() { // access the local player's character controller const localcharacter = zepetoplayers instance localplayer zepetoplayer character charactercontroller; // check if the character controller is touching another collider using isgrounded if (localcharacter isgrounded) { this mytext text = "character is on the ground"; } else { this mytext text = "character is not on the ground"; } } } step 2 setting up text ui add ui > text to the scene in the hierachy window, connect the canvas > text component to the property displayed in the zepetoscript inspector window by dragging and dropping step 3 run if you press the play button to run it, you can check whether the character is on the floor through the text ui