INNER CODE UNIT · Rust

PITCH_LIMIT

dust-engine/dust · crates/character/src/lib.rs:457

            const PITCH_LIMIT: f32 = core::f32::consts::FRAC_PI_2 - 0.01;
            character.yaw -= mouse_motion.delta.x * character.mouse_sensitivity;
            character.pitch = (character.pitch
                - mouse_motion.delta.y * character.mouse_sensitivity)
                .clamp(-PITCH_LIMIT, PITCH_LIMIT);
        }
        if keys.just_pressed(KeyCode::Space) {
            character.jump_requested = true;
        }
        if keys.just_pressed(KeyCode::KeyF) {
            character.mode = match character.mode {
                Mode::Walk => Mode::Fly,
                Mode::Fly => Mode::Walk,
            };
        }
        if keys.just_pressed(KeyCode::KeyV) {
            character.view = match character.view {
                View::FirstPerson => View::ThirdPerson,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…