Orthographic Camera

Finally, you need to tell Amethyst to draw in 2D space. This is done by creating an entity with a Camera component using orthographic projection. For more information about orthographic projection, refer to the OpenGL documentation.

The following snippet demonstrates how to set up a Camera that sees entities within screen bounds, where the entities' Z position is between -10.0 and 10.0:

# extern crate amethyst;
use amethyst::core::nalgebra::Orthographic3;
use amethyst::core::transform::Transform;
# use amethyst::prelude::*;
use amethyst::renderer::{
    Camera, Projection, ScreenDimensions

struct ExampleState;

impl SimpleState for ExampleState {
    fn on_start(&mut self, mut data: StateData<'_, GameData<'_, '_>>) {
        // ...

        self.initialize_camera(&mut data.world);

impl ExampleState {
    fn initialize_camera(&mut self, world: &mut World) {
        let (width, height) = {
            let dim = world.read_resource::<ScreenDimensions>();
            (dim.width(), dim.height())

        // Translate the camera to Z coordinate 10.0, and it looks back toward
        // the origin with depth 20.0
        let mut transform = Transform::default();
        transform.set_xyz(0., 0., 10.);

        let camera = world

And you're done! If you would like to see this in practice, check out the sprites or sprites_ordered examples in the examples directory.