创造你的世界
玩家与角色:提示
检查一个角色是否在地面上
5min
在本指南中,我们将向您展示如何根据 isGrounded 函数检查本地玩家的 Zepeto 角色是否在地面上。
📘 CharacterController.isGrounded https://docs.unity3d.com/ScriptReference/CharacterController-isGrounded.html
- 将一个 GameObject 添加到场景中,并添加下面的 IsGrounded 示例脚本。
- 将 UI > 文本添加到场景中。
- 在层级窗口中,通过拖放将 Canvas > 文本组件连接到 ZEPETOScript 检查器窗口中显示的属性。
![Document image Document image](https://images.archbee.com/fCt3n1oCa8rgNJ8fw9I2N-RAHCk3c5aUhBdI87eYIYW-20240904-102412.png?format=webp)
- 如果您按下播放按钮运行它,您可以通过文本 UI 检查角色是否在地面上。
![Document image Document image](https://archbee-image-uploads.s3.amazonaws.com/fCt3n1oCa8rgNJ8fw9I2N-BOg7zNYsCpf2rw-nVr_Hr-20240904-102412.gif)