Expand description
A plugin for touch based camera movement. Supports one finger drag to pan and two finger pinch to zoom.
§How to use
Add TouchCameraPlugin to your app.
ⓘ
App::new().add_plugins((
DefaultPlugins,
TouchCameraPlugin::default()
)).run();You can configure some of the parameters of the plugin by passing a TouchCameraConfig object.
Changing configuration at runtime is currently not supported. 1
ⓘ
let config = TouchCameraConfig {
drag_sensitivity: 2.,
touch_time_min: 0.2,
..Default::default()
};
app.add_plugins((TouchCameraPlugin {config}))The plugin will try to attach itself to a camera. This can be done in either one of the following ways:
- Create a single
Cameracomponent before thePostUpdateschedule. The plugin will attach itself automatically to it. - Manually attach a
TouchCameraTagcomponent to the camera entity you want to be handled by the plugin.Useful if you have multiple active cameras or if method 1) is not possible.
TODO maybe it is, need to test it and update example ↩
Structs§
- Touch
Camera Config - Contains the configuration parameters for the plugin.
A copy of this will be attached as a
Resourceto theApp. - Touch
Camera Plugin - A plugin that will update camera movement based on
Touchgestures that Bevy provides - Touch
Camera Tag - This is the tag that the plugin will scan for and update its
Cameracomponent. You can either attach it manually to your camera, or the plugin will try to attach it to the default camera in thePostStartupschedule