Crates.io | bevy_config_cam |
lib.rs | bevy_config_cam |
version | 0.3.0 |
source | src |
created_at | 2021-05-25 12:31:12.210271 |
updated_at | 2022-04-19 20:22:39.612274 |
description | An easy plug-n-play multifunctional camera that allows for easy setup of a camera and player for a scene. |
homepage | |
repository | https://github.com/BlackPhlox/bevy_config_cam |
max_upload_size | |
id | 401841 |
size | 105,270 |
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.
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.
LookAt | FollowStatic |
---|---|
TopDown | TopDownDirection |
---|---|
FollowBehind | Fps |
---|---|
Free | ? |
---|---|
Any suggestions on other camera modes you want? Let me know by creating an issue :) |
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 | |
CamFwd (Unused) | Toggle between xyz movement relative to world coords or camera local coords and rotation (Free camera-mode only) |
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.
cd bevy_config_cam
)cargo run --release --example simple
)Adding this plugin to your project is very simple, it only requires you to write 2 lines of code.
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"} # <--
fn main() {
App::new()
.insert_resource(Msaa { samples: 4 })
.add_plugins(DefaultPlugins)
.add_plugin(ConfigCam) // <--
// ...
// Your other plugins and game code here
// ...
.run();
}
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.
bevy | bevy_config_cam |
---|---|
0.5 | 0.1.X |
0.6 | 0.2.X |
0.7 | 0.3.X |
The project is under dual license MIT and Apache-2.0, so yoink to your hearts content, just remember the license agreements.
Yes this project is still very much WIP, so PRs are very welcome