The Entity component is the fundamental building block of a PlayCanvas scene. It represents a node in the scene graph and can have components attached to it via its children. You can control its transform properties (name, position, scale, rotation) and attach pointer event listeners directly through props.
To use Entity, wrap other components (like Render) inside it. The Entity component also provides a ParentContext so that child components can access the underlying PlayCanvas Entity instance.
// Basic usage
<Entity name="myEntity" position={[0, 1, 0]}>
<Render type="box" />
</Entity>
// With pointer events
<Entity
position={[0, 1, 0]}
onPointerDown={(e) => console.log('Clicked!')}
onClick={(e) => console.log('Mouse clicked!')}
>
<Render type="sphere" />
</Entity>
<Entity name="myEntity" position={[0, 1, 0]}>
<Render type="box" />
</Entity>