Entities - Wantcha/Chimera GitHub Wiki
The Entity
Chimera is a semi-ECS based game engine using entities as the fundamental objects we can program and interact with. Entities are objects on which we can attach Components in order to make them behave in a certain way. An entity can only have one component of a certain type present on it, an exception being the Lua Script Component.
Entity Wraps
Users can create hierarchies of entities and store them on their machines for future use. These pre-made entities are called Wraps and they can be easily created by dragging the desired entity/hierarchy from the Hierarchy tab onto the File Explorer. The user can also drag a .wrap file back into the Hierarchy to create the entities described by the Wrap.
Entities in script
The user can directly work on the entity on which the Lua Script Component is sitting on by using the entity keyword, which is reserved for this type of behavior. e.g. entity:GetTransformComponent() , entity.name(). Below I will explain an entity's properties and functions available through script.
- string entity.name
The name of the entity.
- bool entity.enabled
Property controlling whether an entity is enabled or disabled.
- void GetEntityByName(string name)
Returns an entity from the scene with the given name.
- void CreateEmptyEntity(string name)
Creates an empty entity into the scene with the given name.
- Entity SpawnWrap(string path)
Creates an Entity Wrap specified at the relative path and returns the root entity of the spawned hierarchy.
Warning: paths are... a bit weird right now. They have to be formatted for the windows c++ system, which means you have to put a double backslash for it to count as a single one e.g. "\\folder\\photos" will translate to the program as "\program\photos". Paths have to be relative to the "assets" folder generated by the project and HAVE to start with a backslash.
- void Destroy(Entity entity)
Destroys the specified entity.