-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Bevy 0.12 #439
Merged
Merged
Update to Bevy 0.12 #439
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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 |
---|---|---|
|
@@ -21,7 +21,7 @@ use crate::prelude::{ | |
use crate::utils; | ||
use bevy::ecs::system::{StaticSystemParam, SystemParamItem}; | ||
use bevy::prelude::*; | ||
use rapier::prelude::*; | ||
use rapier::{math::Real, prelude::*}; | ||
use std::collections::HashMap; | ||
|
||
#[cfg(all(feature = "dim3", feature = "async-collider"))] | ||
|
@@ -682,7 +682,7 @@ pub fn writeback_mass_properties( | |
let scale = context.physics_scale; | ||
|
||
if config.physics_pipeline_active { | ||
for entity in mass_modified.iter() { | ||
for entity in mass_modified.read() { | ||
if let Some(handle) = context.entity2body.get(entity).copied() { | ||
if let Some(rb) = context.bodies.get(handle) { | ||
if let Ok(mut mass_props) = mass_props.get_mut(**entity) { | ||
|
@@ -1187,7 +1187,7 @@ pub fn sync_removals( | |
* Rigid-bodies removal detection. | ||
*/ | ||
let context = &mut *context; | ||
for entity in removed_bodies.iter() { | ||
for entity in removed_bodies.read() { | ||
if let Some(handle) = context.entity2body.remove(&entity) { | ||
let _ = context.last_body_transform_set.remove(&handle); | ||
context.bodies.remove( | ||
|
@@ -1220,7 +1220,7 @@ pub fn sync_removals( | |
/* | ||
* Collider removal detection. | ||
*/ | ||
for entity in removed_colliders.iter() { | ||
for entity in removed_colliders.read() { | ||
if let Some(parent) = context.collider_parent(entity) { | ||
mass_modified.send(parent.into()); | ||
} | ||
|
@@ -1250,7 +1250,7 @@ pub fn sync_removals( | |
/* | ||
* Impulse joint removal detection. | ||
*/ | ||
for entity in removed_impulse_joints.iter() { | ||
for entity in removed_impulse_joints.read() { | ||
if let Some(handle) = context.entity2impulse_joint.remove(&entity) { | ||
context.impulse_joints.remove(handle, true); | ||
} | ||
|
@@ -1266,7 +1266,7 @@ pub fn sync_removals( | |
/* | ||
* Multibody joint removal detection. | ||
*/ | ||
for entity in removed_multibody_joints.iter() { | ||
for entity in removed_multibody_joints.read() { | ||
if let Some(handle) = context.entity2multibody_joint.remove(&entity) { | ||
context.multibody_joints.remove(handle, true); | ||
} | ||
|
@@ -1284,23 +1284,23 @@ pub fn sync_removals( | |
/* | ||
* Marker components removal detection. | ||
*/ | ||
for entity in removed_sensors.iter() { | ||
for entity in removed_sensors.read() { | ||
if let Some(handle) = context.entity2collider.get(&entity) { | ||
if let Some(co) = context.colliders.get_mut(*handle) { | ||
co.set_sensor(false); | ||
} | ||
} | ||
} | ||
|
||
for entity in removed_colliders_disabled.iter() { | ||
for entity in removed_colliders_disabled.read() { | ||
if let Some(handle) = context.entity2collider.get(&entity) { | ||
if let Some(co) = context.colliders.get_mut(*handle) { | ||
co.set_enabled(true); | ||
} | ||
} | ||
} | ||
|
||
for entity in removed_rigid_body_disabled.iter() { | ||
for entity in removed_rigid_body_disabled.read() { | ||
if let Some(handle) = context.entity2body.get(&entity) { | ||
if let Some(rb) = context.bodies.get_mut(*handle) { | ||
rb.set_enabled(true); | ||
|
@@ -1317,7 +1317,7 @@ pub fn update_colliding_entities( | |
mut collision_events: EventReader<CollisionEvent>, | ||
mut colliding_entities: Query<&mut CollidingEntities>, | ||
) { | ||
for event in collision_events.iter() { | ||
for event in collision_events.read() { | ||
match event.to_owned() { | ||
CollisionEvent::Started(entity1, entity2, _) => { | ||
if let Ok(mut entities) = colliding_entities.get_mut(entity1) { | ||
|
@@ -1507,7 +1507,10 @@ mod tests { | |
use bevy::{ | ||
asset::AssetPlugin, | ||
ecs::event::Events, | ||
render::{settings::WgpuSettings, RenderPlugin}, | ||
render::{ | ||
settings::{RenderCreation, WgpuSettings}, | ||
RenderPlugin, | ||
}, | ||
scene::ScenePlugin, | ||
time::TimePlugin, | ||
window::WindowPlugin, | ||
|
@@ -1631,13 +1634,9 @@ mod tests { | |
#[test] | ||
#[cfg(all(feature = "dim3", feature = "async-collider"))] | ||
fn async_scene_collider_initializes() { | ||
use bevy::scene::scene_spawner_system; | ||
|
||
let mut app = App::new(); | ||
app.add_plugins(HeadlessRenderPlugin).add_systems( | ||
Update, | ||
init_async_scene_colliders.after(scene_spawner_system), | ||
); | ||
app.add_plugins(HeadlessRenderPlugin) | ||
.add_systems(PostUpdate, init_async_scene_colliders); | ||
Comment on lines
+1638
to
+1639
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Old test was failing because the Updated to match the way |
||
|
||
let mut meshes = app.world.resource_mut::<Assets<Mesh>>(); | ||
let cube_handle = meshes.add(Cube::default().into()); | ||
|
@@ -1825,10 +1824,10 @@ mod tests { | |
AssetPlugin::default(), | ||
ScenePlugin::default(), | ||
RenderPlugin { | ||
wgpu_settings: WgpuSettings { | ||
render_creation: RenderCreation::Automatic(WgpuSettings { | ||
backends: None, | ||
..Default::default() | ||
}, | ||
}), | ||
}, | ||
ImagePlugin::default(), | ||
)); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scene_spawner_system
runs in a schedule beforePostUpdate