教程
使用对象移动和障碍物操作的世界示例
38 分
示例项目 📘 讲座视频中使用的项目文件 https //github com/naverz/zepeto world sample/tree/main/assets/chapter1 总结 true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 项目目标 了解如何使用zepeto模板创建unity项目 世界id互操作和zepeto登录 召唤zepeto角色并了解角色控制器 创建默认跳跃地图 使用zepeto脚本控制gameobjects的移动 使用zepeto脚本传送角色 完成世界的示例 https //www youtube com/watch?v=i4zmjqpn7zw 第一部分:设置世界控制台 ❗️ 注意 在观看此视频之前,请遵循 docid\ tp9uduchwsnu 92spsvke 指南 完成基本安装。 学习如何设置 zepeto studio 世界控制台。 学习如何使用 zepeto 模板设置 unity 项目。 英文版 https //www youtube com/watch?v=qlv1z723gem 韩文版 https //www youtube com/watch?v=jqpu5azn0wo 第二部分:设置 zepeto 玩家 学习如何让 zepeto 角色出现在世界中。 英文版 https //www youtube com/watch?v=gsw jxi4c6q 韩文版 https //www youtube com/watch?v=zmwd1qhlyp8 角色控制器脚本 import { zepetoscriptbehaviour } from 'zepeto script'; import { spawninfo, zepetoplayers, localplayer, zepetocharacter } from 'zepeto character controller'; export default class charactercontroller extends zepetoscriptbehaviour { start() { zepetoplayers instance createplayerwithzepetoid("", "\[zepeto id]", new spawninfo(), true); zepetoplayers instance onaddedlocalplayer addlistener(() => { let player localplayer = zepetoplayers instance localplayer; }); } } 第三部分:移动物体 学习如何创建一个移动的gameobject。 英文版 https //www youtube com/watch?v=ecw59kg0jos 韩文版 https //www youtube com/watch?v=hxr9bexwb60 旋转器脚本 import { zepetoscriptbehaviour } from 'zepeto script'; export default class rotator extends zepetoscriptbehaviour { public rotationspeedx number = 0 5; public rotationspeedy number = 0; public rotationspeedz number = 0; update() { this transform rotate(this rotationspeedx, this rotationspeedy, this rotationspeedz); } } movement script import { zepetoscriptbehaviour } from 'zepeto script'; import { vector3, gameobject, object, time } from 'unityengine'; export default class movement extends zepetoscriptbehaviour { public movingtime number = 1; public movingrangex number = 0; public movingrangey number = 2; private delta number = 0; private directionflag bool = true; update() { this delta += time deltatime; if (this delta > this movingtime) { this delta = 0; this directionflag = !this directionflag; } if (this directionflag) { // move upward during the set moving time this transform translate(this movingrangex time deltatime, this movingrangey time deltatime, 0); } else { // move downward during the set moving time this transform translate( 1 this movingrangex time deltatime, 1 this movingrangey time deltatime, 0); } } } 第4部分 传送zepeto角色 学习在角色到达物体时进行传送。 英文版 https //www youtube com/watch?v=8lxwq7k23uy 韩文版 https //www youtube com/watch?v=hhakkpgt2vm 传送脚本 import { collider,vector3,quaternion } from 'unityengine'; import { zepetocharacter, zepetoplayer, zepetoplayers } from 'zepeto character controller'; import { zepetoscriptbehaviour } from 'zepeto script'; export default class teleport extends zepetoscriptbehaviour { private zepetocharacter zepetocharacter; start() { // zepeto角色对象 zepetoplayers instance onaddedlocalplayer addlistener(() => { this zepetocharacter = zepetoplayers instance localplayer zepetoplayer character; }); } ontriggerenter(collider collider) { if (this zepetocharacter == null || collider gameobject != this zepetocharacter gameobject) { return; } // 传送到原点位置 this zepetocharacter teleport(new vector3(0, 0, 0), quaternion identity); } } 第5部分 测试游戏 学习如何在移动设备上进行测试游戏。 英文版 https //www youtube com/watch?v=wfwao8uzlsc 韩文版 https //www youtube com/watch?v=ixj2z47wp k 第6部分:利用资产商店 学习如何奢华地装饰你的世界。 英文版 https //www youtube com/watch?v=xfmrcr skjy 韩文版 https //www youtube com/watch?v=nq10qeyec1m 第7部分:启动世界 学习如何启动世界。 英文版 https //www youtube com/watch?v=cnloh28ezf8 韩文版 https //www youtube com/watch?v=trgrk3gezwo

