INNER CODE UNIT · Rust
eye
dust-engine/dust · crates/character/src/lib.rs:147
pub fn eye(&self, translation: Vec3) -> Vec3 {
translation + Vec3::Y * (self.eye_height - self.height * 0.5)
}
/// Look rotation from `yaw` and `pitch`, looking down -Z when both are zero.
pub fn look_rotation(&self) -> Quat {
Quat::from_euler(EulerRot::YXZ, self.yaw, self.pitch, 0.0)
}
}
/// Marks the entity whose [`Transform`] follows the character `0`'s eyes and look angles.
#[derive(Component, Clone, Copy, Debug)]
pub struct CharacterCamera(pub Entity);
/// Triggered on the character entity when [`Character::view`] changes, so the app
/// can show or hide the character's visible body.
#[derive(EntityEvent, Clone, Copy, Debug)]
pub struct ViewChanged {