blackphlox / bevy_dolly Goto Github PK
View Code? Open in Web Editor NEWh3r2tic's dolly abstraction layer for the bevy game framework
License: Apache License 2.0
h3r2tic's dolly abstraction layer for the bevy game framework
License: Apache License 2.0
This is essential for people not using QWERTY keyboard layouts.
Blocked by Leafwing-Studios/leafwing-input-manager#312
I can implement this whenever the next LWIM is released :)
Just found this repo, looking forward to using it.
Thoughts on a bevy main branch? Created a fork that works with main currently.
Notes:
With<?>
, I realize it has no effect really, was it there for reason?The query state changes lead to code like this, is there a cleaner way to handle E0716
let mut q2 = query.q2();
let mut rig = q2.single_mut();
rig.0.driver_mut.....
Pretty sure bevy_pbr
is only needed for helpers
, but bevy_dolly
uses it unconditionally, forcing 2d-only dependants to compile a bunch of 3d stuff.
error[E0433]: failed to resolve: could not find `helpers` in the crate root
--> /Users/me/.cargo/git/checkouts/bevy_dolly-ae7dd05587c8a08d/dcd1f44/src/lib.rs:16:9
|
16 | helpers::{cone::*, cursor_grab::*, pos_ctrl::*},
| ^^^^^^^ could not find `helpers` in the crate root
error[E0432]: unresolved import `crate::helpers`
--> /Users/me/.cargo/git/checkouts/bevy_dolly-ae7dd05587c8a08d/dcd1f44/src/lib.rs:15:9
|
15 | helpers::*,
| ^^^^^^^ could not find `helpers` in the crate root
Also, does not compile with the helpers
feature.
error[E0599]: no method named `iter` found for reference `&MoveAction` in the current scope
--> /Users/me/.cargo/git/checkouts/bevy_dolly-ae7dd05587c8a08d/dcd1f44/src/helpers/pos_ctrl.rs:127:29
|
127 | for (i, b) in v.iter().enumerate() {
| ^^^^ method not found in `&MoveAction`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `iter`, perhaps you need to implement one of them:
candidate #1: `Walker`
candidate #2: `bevy::reflect::Array`
candidate #3: `bevy::reflect::List`
candidate #4: `bevy::reflect::Map`
candidate #5: `bitflags::traits::Flags`
candidate #6: `sysinfo::traits::NetworksExt`
error[E0599]: no method named `len` found for reference `&MoveAction` in the current scope
--> /Users/me/.cargo/git/checkouts/bevy_dolly-ae7dd05587c8a08d/dcd1f44/src/helpers/pos_ctrl.rs:145:22
|
145 | if v.len() > 1 && i != v.len() - 1 {
| ^^^ method not found in `&MoveAction`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `len`, perhaps you need to implement one of them:
candidate #1: `ExactSizeIterator`
candidate #2: `bevy::reflect::Array`
candidate #3: `bevy::reflect::List`
candidate #4: `bevy::reflect::Map`
candidate #5: `BufferRef`
candidate #6: `RuntimeSizedArray`
candidate #7: `core_graphics::data_provider::CustomData`
error[E0599]: no method named `len` found for reference `&MoveAction` in the current scope
--> /Users/me/.cargo/git/checkouts/bevy_dolly-ae7dd05587c8a08d/dcd1f44/src/helpers/pos_ctrl.rs:145:42
|
145 | if v.len() > 1 && i != v.len() - 1 {
| ^^^ method not found in `&MoveAction`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `len`, perhaps you need to implement one of them:
candidate #1: `ExactSizeIterator`
candidate #2: `bevy::reflect::Array`
candidate #3: `bevy::reflect::List`
candidate #4: `bevy::reflect::Map`
candidate #5: `BufferRef`
candidate #6: `RuntimeSizedArray`
candidate #7: `core_graphics::data_provider::CustomData`
error[E0599]: no method named `len` found for reference `&MoveAction` in the current scope
--> /Users/me/.cargo/git/checkouts/bevy_dolly-ae7dd05587c8a08d/dcd1f44/src/helpers/pos_ctrl.rs:149:27
|
149 | if i == v.len() - 1 {
| ^^^ method not found in `&MoveAction`
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following traits define an item `len`, perhaps you need to implement one of them:
candidate #1: `ExactSizeIterator`
candidate #2: `bevy::reflect::Array`
candidate #3: `bevy::reflect::List`
candidate #4: `bevy::reflect::Map`
candidate #5: `BufferRef`
candidate #6: `RuntimeSizedArray`
candidate #7: `core_graphics::data_provider::CustomData`
Seeing as Bevy 0.10 is about to be released, I thought it's time to put this in the room ๐
As Bevy changed the API for bundle and system (and soon plugin) adding to accept tuples instead of multiple calls to a builder function, I think we should follow suit:
Rig::builder()
.with(Position::new(Vec3::ZERO))
.with(YawPitch::new().yaw_degrees(45.0).pitch_degrees(-30.0))
.with(Smooth::new_position(0.3))
.with(Smooth::new_rotation(0.3))
.with(Arm::new(Vec3::Z * 4.0))
.build()
becomes
Rig::builder()
.with((
Position::new(Vec3::ZERO),
YawPitch::new().yaw_degrees(45.0).pitch_degrees(-30.0),
Smooth::new_position(0.3),
Smooth::new_rotation(0.3),
Arm::new(Vec3::Z * 4.0)
))
.build()
leafwing_input_manager
CursorGrab
PosCtrl
Cone
?Start with impl. here and move helpers to bevy_config_cam
for more ergonomic example support
Generic System:
//App
.add_system(dolly_update_system::<MyRig>)
//Setup
commands
.spawn()
//.insert(Some Transform)
.insert(Rig::builder(/*...*/))
.insert(MyRig);
//Generic System
fn dolly_update_system<T: Component>(mut query: Query<Rig, With<T>>) {
for rig in query.iter() {
rig.update()
}
}
System Param:
//WIP
#[derive(SystemParam)]
struct CameraUpdater<'w, 's> {
players: Query<'w, 's, &'static Player>,
count: ResMut<'w, PlayerCount>,
}
impl<'w, 's> CameraUpdater<'w, 's> {
fn update(&mut self) {
self.update()
}
}
/// The [`SystemParam`] can be used directly in a system argument.
fn update_camera(mut query: Query<Transform, With<Camera3D>>, mut cam_updater: CameraUpdater) {
let t = cam_updater.update();
for cams in query.iter() {
cams = t;
}
}
By this I mean functions like transform_2_bevy
. Because the numbers 2 and 3 have significant connotations in glam
(and by extent Bevy) with the dimensionality, I was confused about this function. The rust ecosystem already provides a trait for exactly this kind of conversion, namely From
and the automatically implemented To
, so I suggest we use this instead. If you are fine with this change, I volunteer to implement it and setup a PR :)
It seems to me that the following kind of code...
commands.spawn((
MainCamera,
Rig::builder()
.with(Fpv::from_position_target(transform))
.build(),
));
commands.spawn((
MainCamera,
Camera3dBundle {
transform,
..default()
},
));
...could be more easily written as
commands.spawn((
MainCamera,
Rig::builder()
.with(Fpv::from_position_target(transform))
.build(),
Camera3dBundle {
transform,
..default()
},
));
From a quick check, it seems like the examples behave the same way, although this was not an extensive test.
I assume that the design decision of not requiring this in the first place is to mix and match rigs and cameras, right?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.