pub fn voxel_clicking_system(
    voxel_cursor_impact: Res<VoxelCursorRayImpact>,
    mouse_input: Res<Input<MouseButton>>,
    mut state: ResMut<VoxelCursorStates>,
) {
    for button in [MouseButton::Left, MouseButton::Middle, MouseButton::Right]
        .iter()
        .cloned()
    {
        let state = match button {
            MouseButton::Left => &mut state.left_states,
            MouseButton::Middle => &mut state.middle_states,
            MouseButton::Right => &mut state.right_states,
            x => panic!("Button {:?} not supported", x),
        };

        if let Some((impact, normal)) = voxel_cursor_impact.get() {
            if mouse_input.just_pressed(button) {
                state.press_start_face = Some(VoxelFace {
                    point: impact.point,
                    normal: *normal,
                });
            }
        }
    }
}
/// Remembers which voxel the cursor was on when mouse buttons were pressed.
Remembers which voxel the cursor was on when mouse buttons were pressed.
Remembers which voxel the cursor was on when mouse buttons were pressed .
pub fn voxel_clicking_system(
    voxel_cursor_impact: Res<VoxelCursorRayImpact>,
    mouse_input: Res<Input<MouseButton>>,
    mut state: ResMut<VoxelCursorStates>,
) {
    for button in [MouseButton::Left, MouseButton::Middle, MouseButton::Right]
        .iter()
        .cloned()
    {
        let state = match button {
            MouseButton::Left => &mut state.left_states,
            MouseButton::Middle => &mut state.middle_states,
            MouseButton::Right => &mut state.right_states,
            x => panic!("Button {:?} not supported", x),
        };
        if let Some((impact, normal)) = voxel_cursor_impact.get() {
            if mouse_input.just_pressed(button) {
                state.press_start_face = Some(VoxelFace {
                    point: impact.point,
                    normal: *normal,
                });
            }
        }
    }
}
pub fn voxel_clicking_system ( voxel_cursor_impact : Res < VoxelCursorRayImpact > , mouse_input : Res < Input < MouseButton > > , mut state : ResMut < VoxelCursorStates > , ) { for button in [ MouseButton :: Left , MouseButton :: Middle , MouseButton :: Right ] . iter ( ) . cloned ( ) { let state = match button { MouseButton :: Left => & mut state . left_states , MouseButton :: Middle => & mut state . middle_states , MouseButton :: Right => & mut state . right_states , x => panic ! ( " " x ) , } ; if let Some ( ( impact , normal ) ) = voxel_cursor_impact . get ( ) { if mouse_input . just_pressed ( button ) { state . press_start_face = Some ( VoxelFace { point : impact . point , normal : * normal , } ) ; } } } }
Remembers which voxel the cursor was on when mouse buttons were pressed.
Remembers which voxel the cursor was on when mouse buttons were pressed .
voxel_cursor_impact
Res<VoxelCursorRayImpact>
mouse_input
Res<Input<MouseButton>>
state
ResMut<VoxelCursorStates>
voxel_cursor_impact
Res<VoxelCursorRayImpact>
mouse_input
Res<Input<MouseButton>>
state
ResMut<VoxelCursorStates>