# Bevy scrolling 2d camera plugin Here is a simple 2d camera plugin for bevy engine, supporting scrolling with mouse right dragging and zooming with mouse wheel. It is suitable for RTS or Simulation 2D games. Check the cargo project in _example_ folder to see how it works. | bevy | bevy_scrolling_2d_camera | |-------|---------------------| | 0.14.1 | 0.3.0 | | 0.13 | ^0.1.* | ## Idea of the dragging function By pressing down the right mouse button, the plugin records the cursor position. The vector from this record position to the current cursor position is used as the camera velocity. The camera updates its translation based on the calculated veclocity. ## Things added to your project with this plugin This plugin is minimum, but it adds the following things to your project. 1. A resource holding the entity of the camera. ```rust #[derive(Resource)] pub struct ScrollingCamera{ pub entity: Option, } ``` 2. A resource storing the velocity of the camera ```rust #[derive(Resource)] pub struct CameraVelocity{ pub v: Vec3, } ``` 3. A resource marking the cursor position when pressing down the right mouse button. ```rust #[derive(Resource)] pub struct CapturedMouseRightClickPosition{ pub pos: Option, } ``` 4. A resource confining the zoom scale. (Added from 0.2.0) ```rust #[derive(Resource)] pub struct ZoomBound{ pub max: f32, pub min: f32, } ``` 5. A state enum marking the current state of the camera. ```rust #[derive(States, Debug, Clone, Copy, Eq, PartialEq, Hash, Default)] pub enum CameraState { #[default] Idling, Scrolling, } ``` 6. Four updating systems to control the movement of the camera. ```rust pub fn camera_move( mut query: Query<&mut Transform, With>, velocity: Res, time: Res