Skip to content

Capsule

A THREE.CapsuleGeometry with radius 0.5, length 1, 4 cap subdivisions, and 8 radial segments.

ts
import { Behaviour } from "@relu-interactives/spatial-ecs";

export default class SpawnCapsule extends Behaviour {
  init() {
    const objects = this.world.getObjectManagementSystem();
    objects?.requestCreate("capsule", {
      name: "Player",
      transform: { position: { x: 0, y: 1, z: 0 } },
    });
  }
}

Payload

FieldTypeDefaultDescription
namestring"Capsule"Display name.
transformTransformDataidentityPosition / rotation (radians) / scale.
parentIdEntityId | nullnullOptional parent entity.

Components attached

Transform, Object3DRef, Name, EntityType, ParentId, Selectable, Mesh, Material, MeshGeometry.