jpskill.com
🛠️ 開発・MCP コミュニティ

hytopia-entities

HYTOPIA SDKを使ったゲームで、ゲームオブジェクトやNPCなどのインタラクティブな要素を生成・管理し、Entityクラスやアニメーション、ライフサイクルなどを制御することで、ゲーム開発を効率化するSkill。

📜 元の英語説明(参考)

Helps create and manage entities in HYTOPIA SDK games. Use when users need to create game objects, NPCs, items, or any interactive objects. Covers Entity class, spawn/despawn, components, animations, and lifecycle management.

🇯🇵 日本人クリエイター向け解説

一言でいうと

HYTOPIA SDKを使ったゲームで、ゲームオブジェクトやNPCなどのインタラクティブな要素を生成・管理し、Entityクラスやアニメーション、ライフサイクルなどを制御することで、ゲーム開発を効率化するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o hytopia-entities.zip https://jpskill.com/download/9061.zip && unzip -o hytopia-entities.zip && rm hytopia-entities.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9061.zip -OutFile "$d\hytopia-entities.zip"; Expand-Archive "$d\hytopia-entities.zip" -DestinationPath $d -Force; ri "$d\hytopia-entities.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して hytopia-entities.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → hytopia-entities フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

HYTOPIA Entities

このスキルは、HYTOPIA SDK ゲームでエンティティを作成および管理するのに役立ちます。

このスキルを使用する場面

ユーザーが以下を希望する場合に、このスキルを使用します。

  • ゲームオブジェクト、NPC、アイテム、またはインタラクティブオブジェクトを作成したい
  • エンティティをスポーンまたはデスポーンする必要がある
  • エンティティのコンポーネントまたは動作について質問する
  • エンティティをアニメーション化するか、エンティティのライフサイクルを処理したい
  • エンティティ間の衝突判定が必要
  • プレイヤーエンティティと非プレイヤーエンティティについて質問する

コアとなるエンティティの概念

エンティティの作成

import { Entity } from 'hytopia';

class MyEntity extends Entity {
  constructor() {
    super();
    // エンティティのプロパティを初期化します
  }

  onSpawn() {
    // エンティティがワールドにスポーンされたときに呼び出されます
  }

  onDespawn() {
    // エンティティがワールドから削除されたときに呼び出されます
  }

  tick(deltaTime: number) {
    // 毎フレーム呼び出されます - 継続的な更新に使用します
  }
}

エンティティのスポーン

// ワールドにエンティティをスポーンします
const entity = new MyEntity();
world.spawnEntity(entity, {
  position: { x: 0, y: 10, z: 0 },
  rotation: { x: 0, y: 0, z: 0 }
});

// 完了したらデスポーンします
world.despawnEntity(entity);

モデルを持つエンティティ

import { Entity, Model } from 'hytopia';

class ItemEntity extends Entity {
  constructor() {
    super();
    this.model = new Model({
      modelUri: 'models/sword.gltf',
      scale: 0.5
    });
  }
}

エンティティのコンポーネント

import { Entity, PhysicsComponent, HealthComponent } from 'hytopia';

class EnemyEntity extends Entity {
  constructor() {
    super();

    // 物理を追加します
    this.addComponent(new PhysicsComponent({
      mass: 10,
      colliders: [/* 衝突形状 */]
    }));

    // ヘルスを追加します
    this.addComponent(new HealthComponent({
      maxHealth: 100,
      currentHealth: 100
    }));
  }
}

一般的なパターン

プレイヤーの追跡

tick(deltaTime: number) {
  const player = world.getClosestPlayer(this.position);
  if (player) {
    const direction = player.position.subtract(this.position).normalize();
    this.position.add(direction.multiply(5 * deltaTime));
  }
}

投射物エンティティ

class Projectile extends Entity {
  velocity: Vector3;
  lifetime: number = 5;

  tick(deltaTime: number) {
    this.position.add(this.velocity.multiply(deltaTime));
    this.lifetime -= deltaTime;

    if (this.lifetime <= 0) {
      world.despawnEntity(this);
    }
  }
}

ベストプラクティス

  1. onDespawn()常にクリーンアップ してください - イベントリスナーを削除し、サウンドを停止します
  2. tick() は控えめに使用 してください - 毎フレーム高負荷な処理を行うとパフォーマンスが低下します
  3. 再利用可能なエンティティをプール してください - 同じタイプのエンティティを常にスポーン/デスポーンしないでください
  4. 適切な衝突レイヤーを設定 してください - レイヤーを使用して、何と衝突するかをフィルタリングします
  5. ネットワークを効率的に 使用してください - 変更され、クライアントに表示する必要があるプロパティのみを同期します

避けるべき一般的な間違い

  • コンストラクタで super() を呼び出すのを忘れないでください
  • クライアントでエンティティのプロパティを直接変更しないでください - サーバーが権限を持ちます
  • ワールドが初期化される前にエンティティをスポーンしないでください
  • ゲーム終了時にエンティティのクリーンアップを処理するのを忘れないでください
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

HYTOPIA Entities

This skill helps you create and manage entities in HYTOPIA SDK games.

When to Use This Skill

Use this skill when the user:

  • Wants to create game objects, NPCs, items, or interactive objects
  • Needs to spawn or despawn entities
  • Asks about entity components or behaviors
  • Wants to animate entities or handle entity lifecycle
  • Needs collision detection between entities
  • Asks about player entities vs non-player entities

Core Entity Concepts

Creating an Entity

import { Entity } from 'hytopia';

class MyEntity extends Entity {
  constructor() {
    super();
    // Initialize entity properties
  }

  onSpawn() {
    // Called when entity is spawned into the world
  }

  onDespawn() {
    // Called when entity is removed from the world
  }

  tick(deltaTime: number) {
    // Called every frame - use for continuous updates
  }
}

Spawning Entities

// Spawn an entity in the world
const entity = new MyEntity();
world.spawnEntity(entity, {
  position: { x: 0, y: 10, z: 0 },
  rotation: { x: 0, y: 0, z: 0 }
});

// Despawn when done
world.despawnEntity(entity);

Entity with Model

import { Entity, Model } from 'hytopia';

class ItemEntity extends Entity {
  constructor() {
    super();
    this.model = new Model({
      modelUri: 'models/sword.gltf',
      scale: 0.5
    });
  }
}

Entity Components

import { Entity, PhysicsComponent, HealthComponent } from 'hytopia';

class EnemyEntity extends Entity {
  constructor() {
    super();

    // Add physics
    this.addComponent(new PhysicsComponent({
      mass: 10,
      colliders: [/* collision shapes */]
    }));

    // Add health
    this.addComponent(new HealthComponent({
      maxHealth: 100,
      currentHealth: 100
    }));
  }
}

Common Patterns

Following Player

tick(deltaTime: number) {
  const player = world.getClosestPlayer(this.position);
  if (player) {
    const direction = player.position.subtract(this.position).normalize();
    this.position.add(direction.multiply(5 * deltaTime));
  }
}

Projectile Entity

class Projectile extends Entity {
  velocity: Vector3;
  lifetime: number = 5;

  tick(deltaTime: number) {
    this.position.add(this.velocity.multiply(deltaTime));
    this.lifetime -= deltaTime;

    if (this.lifetime <= 0) {
      world.despawnEntity(this);
    }
  }
}

Best Practices

  1. Always clean up in onDespawn() - remove event listeners, stop sounds
  2. Use tick() sparingly - expensive operations every frame hurt performance
  3. Pool reusable entities - don't constantly spawn/despawn the same type
  4. Set proper collision layers - use layers to filter what collides with what
  5. Network efficiently - only sync properties that change and need to be visible to clients

Common Mistakes to Avoid

  • Don't forget to call super() in constructor
  • Don't modify entity properties directly on the client - server is authoritative
  • Don't spawn entities before world is initialized
  • Don't forget to handle entity cleanup on game end