Skip to content

Commit

Permalink
Update to Bevy 0.6 main branch.
Browse files Browse the repository at this point in the history
The biggest change here is that doing the same query twice, one mutably and one
immutably, is no longer needed, once bevyengine/bevy#2305 lands. Before that
lands, however, this upgrade is actually impossible to do safely, since the
`q0`/`q0_mut` distinction is gone and therefore it's impossible to implement
the Rapier component traits on Bevy queries. (This is filed upstream as
bevyengine/bevy#2744.) Therefore, this upgrade has to wait until that Bevy PR
lands.

Other minor changes:

* `Light` has been renamed to `PointLight`.

* `App::build()` is now `App::new()`, and `AppBuilder` is now `App`.

* `glam` has been upgraded upstream.
  • Loading branch information
pcwalton committed Aug 30, 2021
1 parent f3e984c commit c3e061e
Show file tree
Hide file tree
Showing 29 changed files with 261 additions and 316 deletions.
6 changes: 3 additions & 3 deletions bevy_rapier2d/examples/boxes2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand Down Expand Up @@ -40,9 +40,9 @@ fn setup_graphics(mut commands: Commands, mut configuration: ResMut<RapierConfig

let mut camera = OrthographicCameraBundle::new_2d();
camera.transform = Transform::from_translation(Vec3::new(0.0, 200.0, 0.0));
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(1000.0, 10.0, 2000.0)),
light: Light {
point_light: PointLight {
intensity: 100_000_000_.0,
range: 6000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier2d/examples/contact_filter2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<'a> PhysicsHooksWithQuery<&'a CustomFilterTag> for SameUserDataFilter {
}

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand Down Expand Up @@ -77,9 +77,9 @@ fn setup_graphics(mut commands: Commands, mut configuration: ResMut<RapierConfig

let mut camera = OrthographicCameraBundle::new_2d();
camera.transform = Transform::from_translation(Vec3::new(0.0, 200.0, 0.0));
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(1000.0, 10.0, 2000.0)),
light: Light {
point_light: PointLight {
intensity: 100_000_000_.0,
range: 6000.0,
..Default::default()
Expand Down
7 changes: 4 additions & 3 deletions bevy_rapier2d/examples/debug_despawn2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
use bevy::prelude::*;
use bevy::render::pass::ClearColor;
use bevy_rapier2d::prelude::*;
use nalgebra::Point2;

fn main() {
App::build()
App::new()
.init_resource::<Game>()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.0)))
.insert_resource(Msaa::default())
Expand Down Expand Up @@ -187,8 +188,8 @@ fn spawn_cube(commands: &mut Commands, game: &mut Game) {
let x_dir = coords[*j].0 as f32 - coords[*i].0 as f32;
let y_dir = coords[*j].1 as f32 - coords[*i].1 as f32;

let anchor_1 = Vec2::new(x_dir * 0.5, y_dir * 0.5).into();
let anchor_2 = Vec2::new(x_dir * -0.5, y_dir * -0.5).into();
let anchor_1 = Point2::new(x_dir * 0.5, y_dir * 0.5);
let anchor_2 = Point2::new(x_dir * -0.5, y_dir * -0.5);

commands
.spawn()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier2d/examples/despawn2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct ResizeResource {
}

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand Down Expand Up @@ -54,9 +54,9 @@ fn setup_graphics(mut commands: Commands, mut configuration: ResMut<RapierConfig

let mut camera = OrthographicCameraBundle::new_2d();
camera.transform = Transform::from_translation(Vec3::new(0.0, 200.0, 0.0));
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(1000.0, 10.0, 2000.0)),
light: Light {
point_light: PointLight {
intensity: 100_000_000_.0,
range: 6000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier2d/examples/events2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -38,9 +38,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
fn setup_graphics(mut commands: Commands, mut configuration: ResMut<RapierConfiguration>) {
configuration.scale = 15.0;

commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(1000.0, 10.0, 2000.0)),
light: Light {
point_light: PointLight {
intensity: 100_000_000_.0,
range: 6000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier2d/examples/joints2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand Down Expand Up @@ -41,9 +41,9 @@ fn setup_graphics(mut commands: Commands, mut configuration: ResMut<RapierConfig

let mut camera = OrthographicCameraBundle::new_2d();
camera.transform = Transform::from_translation(Vec3::new(200.0, -200.0, 0.0));
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(1000.0, 10.0, 2000.0)),
light: Light {
point_light: PointLight {
intensity: 100_000_000_.0,
range: 6000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier2d/examples/joints_despawn2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct DespawnResource {
}

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand Down Expand Up @@ -48,9 +48,9 @@ fn setup_graphics(mut commands: Commands, mut configuration: ResMut<RapierConfig

let mut camera = OrthographicCameraBundle::new_2d();
camera.transform = Transform::from_translation(Vec3::new(200.0, -200.0, 0.0));
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(1000.0, 10.0, 2000.0)),
light: Light {
point_light: PointLight {
intensity: 100_000_000_.0,
range: 6000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier2d/examples/locked_rotations2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand Down Expand Up @@ -40,9 +40,9 @@ fn setup_graphics(mut commands: Commands, mut configuration: ResMut<RapierConfig

let mut camera = OrthographicCameraBundle::new_2d();
camera.transform = Transform::from_translation(Vec3::new(0.0, 30.0, 0.0));
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(1000.0, 10.0, 2000.0)),
light: Light {
point_light: PointLight {
intensity: 100_000_000_.0,
range: 6000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier2d/examples/multiple_colliders2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -33,9 +33,9 @@ fn setup_graphics(mut commands: Commands, mut configuration: ResMut<RapierConfig

let mut camera = OrthographicCameraBundle::new_2d();
camera.transform = Transform::from_translation(Vec3::new(0.0, 200.0, 0.0));
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(1000.0, 10.0, 2000.0)),
light: Light {
point_light: PointLight {
intensity: 100_000_000_.0,
range: 6000.0,
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/player_movement2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_rapier2d::prelude::*;
use bevy_rapier2d::rapier::na::Vector2;

fn main() {
App::build()
App::new()
.insert_resource(WindowDescriptor {
title: "Player Movement Example".to_string(),
width: 1000.0,
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier3d/examples/boxes3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -36,9 +36,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(100.0, 10.0, 200.0)),
light: Light {
point_light: PointLight {
intensity: 100_000.0,
range: 3000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier3d/examples/contact_filter3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl<'a> PhysicsHooksWithQuery<&'a CustomFilterTag> for SameUserDataFilter {
}

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -73,9 +73,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(100.0, 10.0, 200.0)),
light: Light {
point_light: PointLight {
intensity: 100_000.0,
range: 3000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier3d/examples/despawn3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct DespawnResource {
}

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -42,9 +42,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(100.0, 10.0, 200.0)),
light: Light {
point_light: PointLight {
intensity: 100_000.0,
range: 3000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier3d/examples/events3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -36,9 +36,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(100.0, 10.0, 200.0)),
light: Light {
point_light: PointLight {
intensity: 100_000.0,
range: 3000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier3d/examples/joints3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -38,9 +38,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(100.0, 10.0, 200.0)),
light: Light {
point_light: PointLight {
intensity: 100_000.0,
range: 3000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier3d/examples/joints_despawn3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct DespawnResource {
}

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -45,9 +45,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(100.0, 10.0, 200.0)),
light: Light {
point_light: PointLight {
intensity: 100_000.0,
range: 3000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier3d/examples/locked_rotations3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -37,9 +37,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(100.0, 10.0, 200.0)),
light: Light {
point_light: PointLight {
intensity: 100_000.0,
range: 3000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier3d/examples/multiple_colliders3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -36,9 +36,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(100.0, 10.0, 200.0)),
light: Light {
point_light: PointLight {
intensity: 100_000.0,
range: 3000.0,
..Default::default()
Expand Down
6 changes: 3 additions & 3 deletions bevy_rapier3d/examples/ray_casting3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use ui::DebugUiPlugin;
mod ui;

fn main() {
App::build()
App::new()
.insert_resource(ClearColor(Color::rgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
Expand All @@ -38,9 +38,9 @@ fn enable_physics_profiling(mut pipeline: ResMut<PhysicsPipeline>) {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn_bundle(LightBundle {
commands.spawn_bundle(PointLightBundle {
transform: Transform::from_translation(Vec3::new(100.0, 10.0, 200.0)),
light: Light {
point_light: PointLight {
intensity: 100_000.0,
range: 3000.0,
..Default::default()
Expand Down
Loading

0 comments on commit c3e061e

Please sign in to comment.