Class: ZoneComponent

pc.ZoneComponent

The ZoneComponent allows you to define an area in world space of certain size. This can be used in various ways, such as affecting audio reverb when audiolistener is within zone. Or create culling system with portals between zones to hide whole indoor sections for performance reasons. And many other possible options. Zones are building blocks and meant to be used in many different ways.

Constructor

(private) new ZoneComponent(system, size)

Parameters:
Name Type Description
system pc.ZoneComponentSystem The ComponentSystem that created this Component
size pc.Vec3 The Size of Box of a Zone.
Source:

Extends

Events

disable

Fired when Component becomes disabled Note: this event does not take in account entity or any of its parent enabled state
Source:
Example
entity.zone.on('disable', function () {
    // component is disabled
});

enable

Fired when Component becomes enabled Note: this event does not take in account entity or any of its parent enabled state
Source:
Example
entity.zone.on('enable', function () {
    // component is enabled
});

remove

Fired when a zone is removed from an entity
Source:
Example
entity.zone.on('remove', function () {
    // zone has been removed from an entity
});

state

Fired when Component changes state to enabled or disabled Note: this event does not take in account entity or any of its parent enabled state
Parameters:
Name Type Description
enabled Boolean True if now enabled, False if disabled
Source:
Example
entity.zone.on('state', function (enabled) {
    // component changed state
});