Skip to main content

<pc-entity>

The <pc-entity> tag is used to define an entity.

Usage

Attributes

AttributeTypeDefaultDescription
enabledBoolean"true"Enabled state of the entity
nameString-Name identifier for the entity
positionVector3"0 0 0"Local-space position as "X Y Z" values
rotationVector3"0 0 0"Local-space rotation as "X Y Z" Euler angles in degrees
scaleVector3"1 1 1"Local-space scale as "X Y Z" values
tagsString-Space-separated list of tags

Events

Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface.

EventDescription
pointerdownFired when a pointer is pressed down on the entity.
pointerenterFired when a pointer enters the entity.
pointerleaveFired when a pointer leaves the entity.
pointermoveFired when a pointer is moved over the entity.
pointerupFired when a pointer is released from the entity.

Example

<pc-entity name="MyEntity" position="1 2 3" rotation="45 0 0" scale="2 2 2" tags="tag1 tag2">
<!-- Child entities and components go here -->
</pc-entity>

JavaScript Interface

You can programmatically create and manipulate <pc-entity> elements using the EntityElement API.