18 releases (8 breaking)

0.9.1 Dec 10, 2024
0.9.0 Nov 30, 2024
0.8.1 Jul 5, 2024
0.4.0 Mar 11, 2024

#658 in Game dev

Download history 16/week @ 2024-09-18 28/week @ 2024-09-25 36/week @ 2024-10-02 26/week @ 2024-10-09 67/week @ 2024-10-16 7/week @ 2024-10-23 17/week @ 2024-10-30 14/week @ 2024-11-06 7/week @ 2024-11-13 37/week @ 2024-11-20 211/week @ 2024-11-27 138/week @ 2024-12-04 102/week @ 2024-12-11 11/week @ 2024-12-18 8/week @ 2024-12-25 6/week @ 2025-01-01

229 downloads per month

MIT/Apache

43KB
431 lines

Crates.io docs.rs Bevy tracking

Bevy RTS Camera

A screen recording showing camera movement

Summary

Bevy RTS Camera provides an RTS-style camera for Bevy Engine, to get your game up and running quickly. Designed for simple use cases, and does not try to cover advanced requirements.

Features:

  • Pan, zoom, and rotation
  • Automatically follows whatever you mark as 'ground'
  • Smoothed movement
  • Customisable controls and other settings
  • Comes with optional controller, or you can control it yourself

Default Controller

A default controller is included with these default controls:

  • Arrow Keys: pan
  • Mouse Wheel: zoom
  • Middle Mouse: rotate

You can also 'edge pan' by moving the mouse to the edge of the screen.

Quick Start

Add the plugin:

.add_plugins(RtsCameraPlugin)

Add RtsCamera (this will automatically add a Camera3d but you can add it manually if necessary):

commands.spawn((
    RtsCamera::default(),
    RtsCameraControls::default(),  // Optional
));

Add Ground to your ground/terrain entities:

commands.spawn((
    PbrBundle {
        mesh: meshes.add(Plane3d::default().mesh().size(80.0, 80.0)),
        ..default()
    },
    Ground,
));

This will set up a camera at world origin with good defaults based on a roughly realistic scale (where an average human is 1.75 units tall).

Check out the advanced example to see the possible configuration options.

Version Compatibility

bevy bevy_rts_camera
0.15 0.9
0.14 0.8
0.13 0.1-0.7

License

All code in this repository is dual-licensed under either:

at your option. This means you can select the license you prefer! This dual-licensing approach is the de-facto standard in the Rust ecosystem and there are very good reasons to include both.

Dependencies

~39–71MB
~1M SLoC