Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-blackbird committed Feb 17, 2024
1 parent a35a605 commit 18ad20a
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 23 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ opt-level = 1
codegen-units = 1

[patch.crates-io]
bevy = { git = "https://github.com/bevyengine/bevy" }
nalgebra = { git = "https://github.com/dimforge/nalgebra" }

#nalgebra = { path = "../nalgebra" }
#parry2d = { path = "../parry/crates/parry2d" }
#parry3d = { path = "../parry/crates/parry3d" }
Expand Down
8 changes: 4 additions & 4 deletions bevy_rapier2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ headless = []
async-collider = [ "bevy/bevy_asset", "bevy/bevy_scene" ]

[dependencies]
bevy = { version = "0.12", default-features = false }
nalgebra = { version = "0.32.3", features = [ "convert-glam024" ] }
bevy = { version = "0.13", default-features = false }
nalgebra = { version = "0.32.3", features = [ "convert-glam025" ] }
rapier2d = "0.18.0"
bitflags = "2.4"
log = "0.4"
serde = { version = "1", features = [ "derive" ], optional = true}

[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = ["x11"]}
bevy = { version = "0.13", default-features = false, features = ["x11"] }
oorandom = "11"
approx = "0.5.1"
glam = { version = "0.24", features = [ "approx" ] }
glam = { version = "0.25", features = [ "approx" ] }

[package.metadata.docs.rs]
# Enable all the features when building the docs on docs.rs
Expand Down
10 changes: 5 additions & 5 deletions bevy_rapier2d/examples/player_movement2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ pub fn spawn_player(mut commands: Commands, mut rapier_config: ResMut<RapierConf
}

pub fn player_movement(
keyboard_input: Res<Input<KeyCode>>,
keyboard_input: Res<ButtonInput<KeyCode>>,
mut player_info: Query<(&Player, &mut Velocity)>,
) {
for (player, mut rb_vels) in &mut player_info {
let up = keyboard_input.any_pressed([KeyCode::W, KeyCode::Up]);
let down = keyboard_input.any_pressed([KeyCode::S, KeyCode::Down]);
let left = keyboard_input.any_pressed([KeyCode::A, KeyCode::Left]);
let right = keyboard_input.any_pressed([KeyCode::D, KeyCode::Right]);
let up = keyboard_input.any_pressed([KeyCode::KeyW, KeyCode::ArrowUp]);
let down = keyboard_input.any_pressed([KeyCode::KeyS, KeyCode::ArrowDown]);
let left = keyboard_input.any_pressed([KeyCode::KeyA, KeyCode::ArrowLeft]);
let right = keyboard_input.any_pressed([KeyCode::KeyD, KeyCode::ArrowRight]);

let x_axis = -(left as i8) + right as i8;
let y_axis = -(down as i8) + up as i8;
Expand Down
4 changes: 2 additions & 2 deletions bevy_rapier2d/examples/testbed2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct ExamplesRes {

fn main() {
let mut app = App::new();
app.add_state::<Examples>()
app.init_state::<Examples>()
.init_resource::<ExamplesRes>()
.add_plugins((
DefaultPlugins,
Expand Down Expand Up @@ -186,7 +186,7 @@ fn cleanup(world: &mut World) {
fn check_toggle(
state: Res<State<Examples>>,
mut next_state: ResMut<NextState<Examples>>,
mouse_input: Res<Input<MouseButton>>,
mouse_input: Res<ButtonInput<MouseButton>>,
) {
if mouse_input.just_pressed(MouseButton::Left) {
let next = match *state.get() {
Expand Down
8 changes: 4 additions & 4 deletions bevy_rapier3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ headless = [ ]
async-collider = [ "bevy/bevy_asset", "bevy/bevy_scene" ]

[dependencies]
bevy = { version = "0.12", default-features = false }
nalgebra = { version = "0.32.3", features = [ "convert-glam024" ] }
bevy = { version = "0.13", default-features = false }
nalgebra = { version = "0.32.3", features = [ "convert-glam025" ] }
rapier3d = "0.18"
bitflags = "2.4"
log = "0.4"
serde = { version = "1", features = [ "derive" ], optional = true}

[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = ["x11", "tonemapping_luts"]}
bevy = { version = "0.13", default-features = false, features = ["x11", "tonemapping_luts"]}
approx = "0.5.1"
glam = { version = "0.24", features = [ "approx" ] }
glam = { version = "0.25", features = [ "approx" ] }

[package.metadata.docs.rs]
# Enable all the features when building the docs on docs.rs
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier3d/examples/ray_casting3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub fn cast_ray(
// Then cast the ray.
let hit = rapier_context.cast_ray(
ray.origin,
ray.direction,
ray.direction.into(),
f32::MAX,
true,
QueryFilter::only_dynamic(),
Expand Down
4 changes: 2 additions & 2 deletions bevy_rapier3d/examples/testbed3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct ExamplesRes {

fn main() {
let mut app = App::new();
app.add_state::<Examples>()
app.init_state::<Examples>()
.init_resource::<ExamplesRes>()
.add_plugins((
DefaultPlugins,
Expand Down Expand Up @@ -177,7 +177,7 @@ fn cleanup(world: &mut World) {
fn check_toggle(
state: Res<State<Examples>>,
mut next_state: ResMut<NextState<Examples>>,
mouse_input: Res<Input<MouseButton>>,
mouse_input: Res<ButtonInput<MouseButton>>,
) {
if mouse_input.just_pressed(MouseButton::Left) {
let next = match *state.get() {
Expand Down
9 changes: 5 additions & 4 deletions src/plugin/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ pub fn update_character_controls(
#[cfg(test)]
mod tests {
#[cfg(all(feature = "dim3", feature = "async-collider"))]
use bevy::prelude::shape::{Capsule, Cube};
use bevy::prelude::{Capsule3d, Cuboid};
use bevy::{
asset::AssetPlugin,
ecs::event::Events,
Expand Down Expand Up @@ -1629,7 +1629,7 @@ mod tests {
.add_systems(Update, init_async_colliders);

let mut meshes = app.world.resource_mut::<Assets<Mesh>>();
let cube = meshes.add(Cube::default().into());
let cube = meshes.add(Cuboid::default());

let entity = app.world.spawn((cube, AsyncCollider::default())).id();

Expand All @@ -1654,8 +1654,8 @@ mod tests {
.add_systems(PostUpdate, init_async_scene_colliders);

let mut meshes = app.world.resource_mut::<Assets<Mesh>>();
let cube_handle = meshes.add(Cube::default().into());
let capsule_handle = meshes.add(Capsule::default().into());
let cube_handle = meshes.add(Cuboid::default());
let capsule_handle = meshes.add(Capsule3d::default());
let cube = app.world.spawn((Name::new("Cube"), cube_handle)).id();
let capsule = app.world.spawn((Name::new("Capsule"), capsule_handle)).id();

Expand Down Expand Up @@ -1843,6 +1843,7 @@ mod tests {
backends: None,
..Default::default()
}),
..Default::default()
},
ImagePlugin::default(),
));
Expand Down
2 changes: 1 addition & 1 deletion src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct BevyLinesRenderBackend<'world, 'state, 'a, 'b> {
physics_scale: f32,
custom_colors: Query<'world, 'state, &'a ColliderDebugColor>,
context: &'b RapierContext,
gizmos: Gizmos<'state>,
gizmos: Gizmos<'world, 'state>,
}

impl<'world, 'state, 'a, 'b> BevyLinesRenderBackend<'world, 'state, 'a, 'b> {
Expand Down

0 comments on commit 18ad20a

Please sign in to comment.