Skip to content

A Swiss Army knife of a camera plugin that allows for easy setup and configuration of a wide variety of types of moveable cameras and player cameras for a scene.

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

BlackPhlox/bevy_config_cam

Repository files navigation

bevy config cam

link to crates.io link to docs.rs link to license downloads/link to crates.io stars/github repo github actions tracking bevy release branch

An easy plug-n-play multifunctional camera controller that allows for easy setup of a camera and player for a scene.

Add a few lines of code to your existing project allows you to test a wide variety of cameras by attaching it to your player asset or the default red player entity.

Inspired and extended on bevy_flycam, this plugin is fairly simple but should be a neat help for developers looking for a camera implementation without going the hassle of reinventing the wheel.

Future Plans

The main goal of this plugin is to first and foremost provide the user with a configurable, extendable and easy-to-use API. dolly by @h3r2tic is a crate that provides an framework for which to create, combine and modify camera positioning, exactly what bevy_config_cam is looking for. So a migration to dolly is in the works in order to improve this plugin main goal.

Showcase

Camera Modes

LookAt FollowStatic
LookAt FollowStatic
TopDown TopDownDirection
TopDown TopDownDirection
FollowBehind Fps
FollowBehind Fps
Free ?
Free Any suggestions on other camera modes you want? Let me know by creating an issue :)

Settings

Camera Mode Disc. Demo
MovementSpeed (Camera) Change the speed of there cameras movement
Sensitivity Change the sensitivity of the cameras mouse movement
Lerp Change the linear interpolation between the target and the player (LookAt camera-mode only)
Zoom/FOV Change the FOV of the camera LowFOV
CamFwd (Unused) Toggle between xyz movement relative to world coords or camera local coords and rotation (Free camera-mode only)

Getting started

Test the project

Before I start using a plugin, I all ways like to run the examples prior to setting it up for my own project. Just to see if the plugin satisfy my needs. If you're like me then this is for you.

  1. Clone this repo to your local machine
  2. Go into the project folder (cd bevy_config_cam)
  3. And run the cargo command (cargo run --release --example simple)
  4. Test functionality
    Player : for movement, RShift & - for going up and down.
    Camera : WASD for movement, Space & LShift for going up and down.
    Switch Camera: C (Look in console for which camera type you are on)
    Settings: E and use the mouse-scroll to change the selected settings value.

Add to your own project

Adding this plugin to your project is very simple, it only requires you to write 2 lines of code.

Step 1. - Setup

Add the correct version to your Cargo.toml, you can find the version you are looking for under the support section. The thing you should be adding should look like this (only add the line marked by # <--):

[dependencies]
bevy = { version = "0.7"}
# ...
bevy_config_cam = { version = "0.3.0"} # <-- 

Step 2. - Add to project

fn main() {
    App::new()
        .insert_resource(Msaa { samples: 4 })
        .add_plugins(DefaultPlugins)
        .add_plugin(ConfigCam) // <--
        // ... 
        // Your other plugins and game code here
        // ...
        .run();
}

Step 3. - Config (Optional)

Now, there is a reason for the name bevy_config_cam. It is most likely that you want something more than just the default behavior. You might want to toggle between 2 types of cameras or allow the user to change the fov using a slider. Currently I haven't gotten far with creating a user-friendly api you can access but is something I will look into. For now you can insert two resources to override the default behavior of the plugin, as seen in the example:

    .insert_resource(MovementSettings {
        sensitivity: 0.00015, // default: 0.00012
        speed: 15.0,          // default: 12.0
        dist: 5.0,            // Camera distance from the player in topdown view
        ..Default::default()
    })
    .insert_resource(PlayerSettings {
        pos: Vec3::new(2., 0., 0.),//Initial position of the player
        player_asset: "models/craft_speederA.glb#Scene0", //Model of the player, default is a red cube
        ..Default::default()
    })

Note: That some of them are overwritten by accessing the settings or the changing the camera type. Feedback on this is high appreciated, just create a new issue and I'll look into it when I have the time.

Support

Bevy tracking

bevy bevy_config_cam
0.5 0.1.X
0.6 0.2.X
0.7 0.3.X

Licensing

The project is under dual license MIT and Apache-2.0, so yoink to your hearts content, just remember the license agreements.

Contributing

Yes this project is still very much WIP, so PRs are very welcome

About

A Swiss Army knife of a camera plugin that allows for easy setup and configuration of a wide variety of types of moveable cameras and player cameras for a scene.

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages