Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Useful information of amethyst game engine

Coords

The coordinate system is +Y up, and the camera looks toward -Z

Components

A component must be registered before used. It is registerd automatically in the setup function by the System trait. If, for any reason, the component is not yet used by any system, you can register it using the below code, and thus avoid panics.

world.register::<MyComponent>()

Meshes

To create a new primitive mesh is possible to use the following helper:

use amethyst::renderer::Shape;
 let sphere_mesh_data : types::MeshData = Shape::Sphere(32, 32)
                    .generate::<(Vec<Position>, Vec<Normal>, Vec<Tangent>, Vec<TexCoord>)>(None)
                    .into();

Is it also important to notice that to be visualized the mesh must have a valid material attached to it.

Entities

Is possible to Add, Remove, entities within the systems. Is also possible Remove or Add components to a particular entity inside a system.

https://github.com/AndreaCatania/amt_tests/blob/master/cubes/src/impulse_system.rs#L42-L53

Of curse is possible to do so even out of the systems, but an extra step is required. You must take the compoent Storages or use the below code:

WriteStorage::<Component>::fetch(&world).insert(entity, component)
WriteStorage::<Component>::fetch(&world).remove(entity)

Custom join filtering

Is possible to populate a BitSet with entity indices and use it to filter a storage. This is a good example on how do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment