Module dotrix::components[][src]

Component usually is just a data structure with or without associated methods. In ECS pattern components represent properties of entities: velocity, weight, model, rigid body, color etc.

Set of components in the entity defines an Archetype. Entities of the same Archetype are being grouped together in the crate::services::World storage, that makes search fast and linear.

When planning the architecture of your game, developer should think about components not only as of properties, but also as of search tags. For example, if you are making physics for your game, and you have a Car and a SpringBoard, you may want to have the same named components, so you can easily query all Cars or all SpringBoards. But as soon as you will need to calculate physics for entities of the both types, you should add some component like RigidBody to the entities, so you can calculate physics for all entities who have that component.

Usefull references

Structs

AmbientLight

Component to be added to entities

Animator

Component to control model animation

DirLight

Component to be added to entities

Model

3D model component

PointLight

Component to be added to entities

SimpleLight

Component to be added to entities

SkyBox

SkyBox component

SpotLight

Component to be added to entities

WireFrame

Component to draw wire frames