-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
193 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ Cargo.lock | |
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# IDE | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "bevy_flycam" | ||
version = "0.9.0" | ||
version = "0.10.0" | ||
authors = ["Spencer Burris <[email protected]>"] | ||
edition = "2021" | ||
license = "ISC" | ||
|
@@ -10,11 +10,10 @@ repository = "https://github.com/sburris0/bevy_flycam/" | |
readme = "README.md" | ||
keywords = ["gamedev", "bevy", "3d", "camera"] | ||
categories = ["game-engines", "game-development"] | ||
resolver = "2" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[dependencies] | ||
bevy = {version = "0.9", default-features = false, features = ["bevy_render", "bevy_core_pipeline", "bevy_asset"]} | ||
bevy = { version = "0.10.0", default-features = false, features = ["bevy_render", "bevy_core_pipeline", "bevy_asset"] } | ||
|
||
[dev-dependencies] | ||
bevy = {version = "0.9", default-features = false, features = ["x11", "wayland", "bevy_pbr", "bevy_core_pipeline", "bevy_asset"]} | ||
bevy = { version = "0.10.0", default-features = false, features = ["x11", "wayland", "bevy_pbr", "bevy_core_pipeline", "bevy_asset"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Remove the line below if you are copying this to your own project | ||
extern crate bevy_flycam; | ||
|
||
use bevy::prelude::*; | ||
use bevy_flycam::PlayerPlugin; | ||
use bevy_flycam::{KeyBindings, MovementSettings}; | ||
|
||
//From bevy examples: | ||
//https://github.com/bevyengine/bevy/blob/latest/examples/3d/3d_scene.rs | ||
|
||
fn main() { | ||
App::build() | ||
.insert_resource(Msaa { samples: 4 }) | ||
.add_plugins(DefaultPlugins) | ||
.add_plugin(PlayerPlugin) | ||
.insert_resource(MovementSettings { | ||
sensitivity: 0.00015, // default: 0.00012 | ||
speed: 12.0, // default: 12.0 | ||
}) | ||
.insert_resource(KeyBindings { | ||
move_forward: KeyCode::A, | ||
move_backward: KeyCode::Z, | ||
move_left: KeyCode::Q, | ||
move_right: KeyCode::W, | ||
move_ascend: KeyCode::C, | ||
move_descend: KeyCode::V, | ||
toggle_grab_cursor: KeyCode::F, | ||
}) | ||
.add_startup_system(setup.system()) | ||
.run(); | ||
} | ||
|
||
/// set up a simple 3D scene | ||
fn setup( | ||
mut commands: Commands, | ||
mut meshes: ResMut<Assets<Mesh>>, | ||
mut materials: ResMut<Assets<StandardMaterial>>, | ||
) { | ||
// plane | ||
commands.spawn_bundle(PbrBundle { | ||
mesh: meshes.add(Mesh::from(shape::Plane { size: 5.0 })), | ||
material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), | ||
..Default::default() | ||
}); | ||
// cube | ||
commands.spawn_bundle(PbrBundle { | ||
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })), | ||
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), | ||
transform: Transform::from_xyz(0.0, 0.5, 0.0), | ||
..Default::default() | ||
}); | ||
// light | ||
commands.spawn_bundle(LightBundle { | ||
transform: Transform::from_xyz(4.0, 8.0, 4.0), | ||
..Default::default() | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.