A 4X style camera for bevy.

Overview

Crates.io

A 4X style camera for bevy. Demo

Default Key Bindings:

  • W / A / S / D / Arrow Keys / Mouse Left - Move along the horizontal plane
  • Q / E / Mouse Right - Rotate around the center
  • Mouse Wheel - Zoom

Example

use bevy::{prelude::*, render::camera::PerspectiveProjection};
use bevy_4x_camera::{CameraRigBundle, FourXCameraPlugin};

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_plugin(FourXCameraPlugin)
        .add_startup_system(setup.system())
        .run();
}

fn setup(commands: &mut Commands) {
    commands
        // camera
        .spawn(CameraRigBundle::default())
        .with_children(|cb| {
            cb.spawn(Camera3dBundle {
                // I recommend setting the fov to a low value to get a
                // a pseudo-orthographic perspective
                perspective_projection: PerspectiveProjection {
                    fov: 0.1,
                    ..Default::default()
                },
                transform: Transform::from_translation(Vec3::new(-20.0, 20., 0.0))
                    .looking_at(Vec3::zero(), Vec3::unit_y()),
                ..Default::default()
            });
        });
}

Version Matching

Bevy Version bevy_4x_camera Version
0.4.0 0.1.*
You might also like...
Game about automating terraformation in 3D maps, ant-style.

Bioengineer Play the game https://jmmut.itch.io/bioengineer At the moment you can play in the browser (playable with mouse and keyboard), and the plan

A Bevy plugin for loading the LDtk 2D tile map format.
A Bevy plugin for loading the LDtk 2D tile map format.

bevy_ldtk ( Tileset from "Cavernas" by Adam Saltsman ) A Bevy plugin for loading LDtk tile maps. Usage use bevy::prelude::*; use bevy_ldtk::*; fn mai

An ergonomic physics API for bevy games.

Heron An ergonomic physics API for 2d and 3d bevy games. (powered by rapier) How it looks like fn main() { App::build() .add_plugins(DefaultPlug

Inspector plugin for the bevy game engine
Inspector plugin for the bevy game engine

bevy-inspector-egui This crate provides the ability to annotate structs with a #[derive(Inspectable)], which opens a debug interface using egui where

A plugin for Egui integration into Bevy
A plugin for Egui integration into Bevy

bevy_egui This crate provides a Egui integration for the Bevy game engine. Features: Desktop and web (bevy_webgl2) platforms support Clipboard (web su

Crossterm plugin for the bevy game engine
Crossterm plugin for the bevy game engine

What is bevy_crossterm? bevy_crossterm is a Bevy plugin that uses crossterm as a renderer. It provides custom components and events which allow users

Game physics in one weekend with bevy

Game Physics in a Weekend (in Rust) This project is an implementation of the Game Physics in a Weekend book using the Rust programming language and th

A Bevy plugin to use Kira for game audio

Bevy Kira audio This bevy plugin is intended to try integrating Kira into Bevy. The end goal would be to replace or update bevy_audio, if Kira turns o

Concise Reference Book for the Bevy Game Engine

Unofficial Bevy Cheat Book Click here to read the book! Concise reference to programming in the Bevy game engine. Covers useful syntax, features, prog

Comments
  • KeyboardConf and MouseConf have private fields, so can't be configured

    KeyboardConf and MouseConf have private fields, so can't be configured

    Heya,

    I'm trying to customize the settings of the camera, but it appears that both KeyboardConf and MouseConf have private fields. As such I can only use default() to construct them, but can't tune them.

    Is this intentional? If not, would you accept a PR to change this? (or if you prefer, i can implement the builder pattern)

    opened by twitchyliquid64 2
  • Disable keyboard/mouse inputs while user is interacting with a UI element

    Disable keyboard/mouse inputs while user is interacting with a UI element

    Heya,

    I ran into an issue where interacting with a egui UI was causing movements in the camera, even though I was operating on a UI element that was above the scene.

    I went digging and found a similar issue: https://github.com/aevyrie/bevy_mod_picking/issues/51

    Their approach was to have a way to disable picking, so that a system could keep track of whether a GUI element was in focus and disable picking.

    Could we do something similar for bevy_4x_camera ?

    opened by twitchyliquid64 2
  • Camera strange behavior

    Camera strange behavior

    Hi,

    I have observed some strange camera behavior with the current version, it can be reproduced with the board.rs example:

    • [ ] when the mouse is used to rotate (right click) at the same time the keyboard is used to translate (in any direction), the camera translation is way faster than expected. By default the move_sensitivity of the keyboard is quite low so it is difficult to see the issue, but if it is set to a higher value (for example (2.0, 0.4)) the problem becomes quite obvious. Interestingly, there is no issue when keyboard is used both to translate and rotate at the same time
    • [ ] the zoom is not "straight" but always focuses on a point around the bottom left of the window
    • [ ] It took me a while to realize that I actually control the camera rig and not the camera itself. Unfortunately, if the camera and its rig are not oriented the same, the controls are totally "messed up". I think it would be nice to warn about this behavior
    opened by VRichardJP 1
  • Issues after upgrading to bevy 0.5

    Issues after upgrading to bevy 0.5

    All of the following issues can be replicated from examples/board.rs

    • [ ] Follow does not work
    • [ ] Keyboard movement stutters
    • [ ] Mouse zoom is not smooth

    All of these need to be resolved before 0.2 release

    opened by SarthakSingh31 2
Releases(0.1.2)
Owner
null
A simple camera for properly displaying tile-based low resolution pixel perfect 2D games in bevy.

Bevy Tiled Camera A simple camera for properly displaying low resolution pixel perfect 2D games in bevy. The camera will adjust the viewport to scale

sark 10 Oct 5, 2022
A spectator camera plugin for the Bevy game engine

bevy_spectator A spectator camera plugin for the Bevy game engine. Controls Action Key Forward W Left A Backward S Right D Up Space Down LControl Alt.

Jonah Henriksson 5 Jan 2, 2023
Smooth pixel-perfect camera for Bevy

bevy_smooth_pixel_camera A bevy plugin that adds a simple smooth pixel camera. The smoothing is based on this video from aarthificial which explains h

Doonv 9 Nov 14, 2023
Ludum Dare 54 - Rust + Bevy - 2048-style Puzzle game

AM4LGAM8 - Ludum Dare #54 AMALGAMATE (Intransitive verb) : To combine into a unified or integrated whole A game made in 48 hours for the Ludum Dare Ga

Olivier Pinon 3 Oct 3, 2023
Minecraft-esque voxel engine prototype made with the bevy game engine. Pending bevy 0.6 release to undergo a full rewrite.

vx_bevy A voxel engine prototype made using the Bevy game engine. Goals and features Very basic worldgen Animated chunk loading (ala cube world) Optim

Lucas Arriesse 125 Dec 31, 2022
bevy-hikari is an implementation of voxel cone tracing global illumination with anisotropic mip-mapping in Bevy

Bevy Voxel Cone Tracing bevy-hikari is an implementation of voxel cone tracing global illumination with anisotropic mip-mapping in Bevy. Bevy Version

研究社交 208 Dec 27, 2022
A simple extension for `bevy-editor-pls` to support tilemap editing right inside the bevy app.

What is this This is a simple tilemap editor plugin, that hooks right into bevy_editor_pls to work with bevy_ecs_tilemap. It works completely within i

null 3 May 8, 2023
Bevy Simple Portals is a Bevy game engine plugin aimed to create portals.

Portals for Bevy Bevy Simple Portals is a Bevy game engine plugin aimed to create portals. Those portals are (for now) purely visual and can be used t

Sélène Amanita 11 May 28, 2023
Minecraft using Bevy and Bevy-Meshem

minecraft_bevy Minecraft_bevy was built to showcase bevy_meshem. After a week of developing it has: Chunk loading / unloading each chunk's mesh is bei

Adam 7 Oct 4, 2023
API tool,but egui style and rusty

WEAVER About Weaver is a simple,easy-to-use and cross-platform API tool.Inspired by hoppscotch . It uses the Rust egui GUI library. Features Get,Post

will 14 Dec 11, 2022