1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use serde::Serialize;
use specs::{Component, VecStorage};

use crate::Vec3;

/// The direction this entity is looking at.
#[derive(Default, Component, Serialize)]
#[storage(VecStorage)]
pub struct DirectionComp(pub Vec3<f32>);

impl DirectionComp {
    /// Create a component of the direction this entity is looking at.
    pub fn new(x: f32, y: f32, z: f32) -> Self {
        Self(Vec3(x, y, z))
    }
}