オブジェクトの移動と障害物の操作を使用した世界の例
38 分
サンプルプロジェクト
📘 講義ビデオで使用されるプロジェクトファイル https://github.com/naverz/zepeto-world-sample/tree/main/Assets/Chapter1
概要
概要 | - これはZEPETO World開発の初心者向けの講義です。 - ZEPETO World開発のセットアップとZEPETOキャラクターコントローラーの学習。 - 簡単なGameObject移動コードとテレポートコードで完成できるジャンプマップです。 |
|---|---|
難易度 | 初心者 |
必要な時間 | 30分 |
プロジェクトの目標
- ZEPETOテンプレートを使用してUnityプロジェクトを作成する方法を理解する
- World IDの相互運用性とZEPETOログイン
- ZEPETOキャラクターを呼び出し、キャラクターコントローラーを理解する
- デフォルトのジャンプマップを作成する
- ZEPETOスクリプトを使用してGameObjectの動きを制御する
- ZEPETOスクリプトを使用してキャラクターをテレポートする
完成したワールドの例
パート1. ワールドコンソールの設定
❗️ 注意 このビデオを見る前に、次のUnityインストールとZEPETOテンプレート登録ガイド ガイドを完了してください。
- ZEPETOスタジオワールドコンソールの設定方法を学ぶ。
- ZEPETOテンプレートを使用してUnityプロジェクトを設定する方法を学ぶ。
英語版
韓国語版
パート2. ZEPETOプレイヤーの設定
- ZEPETOキャラクターを世界に表示する方法を学びましょう。
英語版
韓国語版
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;
});
}
}
パート3. 動くオブジェクト
- 動くGameObjectの作成方法を学ぶ。
英語版
韓国語版
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);
}
}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キャラクターのテレポート
- オブジェクトに到達したときにキャラクターをテレポートさせる方法を学ぶ。
英語版
韓国語版
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. テストプレイ
- モバイルでのテストプレイの方法を学ぶ。
英語版
韓国語版
第6部. アセットストアの活用
- あなたのワールドを贅沢に装飾する方法を学びましょう。
英語版
韓国語版
第7部. ワールドの立ち上げ
- ワールドを立ち上げる方法を学びましょう。
英語版