pub fn run(&mut self, inputs: &Inputs, delta_sec: f32) {
        let x = if inputs.right && inputs.left {
            0.0
        } else if inputs.right {
            1.0
        } else if inputs.left {
            -1.0
        } else {
            0.0
        };
        let y = if inputs.up && inputs.down {
            0.0
        } else if inputs.up {
            1.0
        } else if inputs.down {
            -1.0
        } else {
            0.0
        };
        let z = if inputs.front && inputs.back {
            0.0
        } else if inputs.front {
            -1.0
        } else if inputs.back {
            1.0
        } else {
            0.0
        };

        self.view.rotation *= UnitQuaternion::from_axis_angle(
            &Vector3::x_axis(),
            (inputs.mouse_y * self.sensitivity) as f32,
        );

        let q = UnitQuaternion::from_axis_angle(
            &Vector3::y_axis(),
            (-inputs.mouse_x * self.sensitivity) as f32,
        );
        self.view.rotation = q * self.view.rotation;

        let translation = Vector3::new(x, y, z);

        let rotation_translation =
            self.view.rotation * translation * (delta_sec as f32 * self.speed);
        self.view.translation.vector += rotation_translation;
    }
/// Provide input to update camera. TODO: Decouple inputs and Camera.
Provide input to update camera. TODO: Decouple inputs and Camera.
Provide input to update camera . TODO : Decouple inputs and Camera .
pub fn run(&mut self, inputs: &Inputs, delta_sec: f32) {
        let x = if inputs.right && inputs.left {
            0.0
        } else if inputs.right {
            1.0
        } else if inputs.left {
            -1.0
        } else {
            0.0
        };
        let y = if inputs.up && inputs.down {
            0.0
        } else if inputs.up {
            1.0
        } else if inputs.down {
            -1.0
        } else {
            0.0
        };
        let z = if inputs.front && inputs.back {
            0.0
        } else if inputs.front {
            -1.0
        } else if inputs.back {
            1.0
        } else {
            0.0
        };
        self.view.rotation *= UnitQuaternion::from_axis_angle(
            &Vector3::x_axis(),
            (inputs.mouse_y * self.sensitivity) as f32,
        );
        let q = UnitQuaternion::from_axis_angle(
            &Vector3::y_axis(),
            (-inputs.mouse_x * self.sensitivity) as f32,
        );
        self.view.rotation = q * self.view.rotation;
        let translation = Vector3::new(x, y, z);
        let rotation_translation =
            self.view.rotation * translation * (delta_sec as f32 * self.speed);
        self.view.translation.vector += rotation_translation;
    }
pub fn run ( & mut self , inputs : & Inputs , delta_sec : f32 ) { let x = if inputs . right && inputs . left { 0.0 } else if inputs . right { 1.0 } else if inputs . left { - 1.0 } else { 0.0 } ; let y = if inputs . up && inputs . down { 0.0 } else if inputs . up { 1.0 } else if inputs . down { - 1.0 } else { 0.0 } ; let z = if inputs . front && inputs . back { 0.0 } else if inputs . front { - 1.0 } else if inputs . back { 1.0 } else { 0.0 } ; self . view . rotation *= UnitQuaternion :: from_axis_angle ( & Vector3 :: x_axis ( ) , ( inputs . mouse_y * self . sensitivity ) as f32 , ) ; let q = UnitQuaternion :: from_axis_angle ( & Vector3 :: y_axis ( ) , ( - inputs . mouse_x * self . sensitivity ) as f32 , ) ; self . view . rotation = q * self . view . rotation ; let translation = Vector3 :: new ( x , y , z ) ; let rotation_translation = self . view . rotation * translation * ( delta_sec as f32 * self . speed ) ; self . view . translation . vector += rotation_translation ; }
Provide input to update camera.
Provide input to update camera .
&mut self
inputs
&Inputs
delta_sec
f32
&mut self
inputs
&Inputs
delta_sec
f32