Component
Component adds data and behavior to entities.
Examples
CameraComponentLightComponentRenderComponentRigidBodyComponent&CollisionComponentScriptComponent
tip
Only add components that are actually needed, and remove unused ones to keep entities lightweight.
Adding Components in Code
entity.addComponent('camera', {
nearClip: 1,
farClip: 100,
fov: 55
});
See addComponent.
Accessing Components
const camera = entity.camera;
Removing Components
entity.removeComponent('camera');
See removeComponent.
Enabling / Disabling Components
entity.model.enabled = false;
See enabled.
tip
Consider disabling components instead of removing them if they're only temporarily not needed.