Removes a component from an existing entity.
Dynamically removes a component at runtime. The entity will no longer match queries that require this component. Uses Miniplex's reactive system.
The Strata world.
The entity to modify.
The component key to remove.
const entity = world.spawn({ position: { x: 0, y: 0, z: 0 }, health: 100});// Remove health component (entity is now invulnerable)removeComponent(world, entity, 'health');// Entity no longer matches 'health' queriesfor (const e of world.query('health')) { // entity is NOT included} Copy
const entity = world.spawn({ position: { x: 0, y: 0, z: 0 }, health: 100});// Remove health component (entity is now invulnerable)removeComponent(world, entity, 'health');// Entity no longer matches 'health' queriesfor (const e of world.query('health')) { // entity is NOT included}
Removes a component from an existing entity.
Dynamically removes a component at runtime. The entity will no longer match queries that require this component. Uses Miniplex's reactive system.