Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,368 changes: 2,295 additions & 1,073 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions crates/avian2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ parry-f64 = ["f64", "dep:parry2d-f64", "default-collider"]
# Enables the XPBD constraint solver for joints.
xpbd_joints = []

bevy_scene = ["bevy/bevy_scene"]
bevy_scene = ["bevy/bevy_world_serialization"]
bevy_picking = ["bevy/bevy_picking"]
serialize = [
"dep:serde",
Expand Down Expand Up @@ -77,18 +77,18 @@ bench = false

[dependencies]
avian_derive = { path = "../avian_derive", version = "0.2" }
bevy = { version = "0.18.0", default-features = false, features = [
bevy = { version = "0.19.0-rc.2", default-features = false, features = [
"std",
"bevy_log",
] }
bevy_math = { version = "0.18.0", features = ["approx"] }
glam_matrix_extras = { version = "0.2", features = ["bevy_reflect"] }
bevy_heavy = { version = "0.4" }
bevy_transform_interpolation = { version = "0.4" }
bevy_math = { version = "0.19.0-rc.2",features = ["approx"] }
glam_matrix_extras = { git = "https://github.com/olukowski/glam_matrix_extras", features = ["bevy_reflect"] }
bevy_heavy = { git = "https://github.com/olukowski/bevy_heavy" }
bevy_transform_interpolation = { git = "https://github.com/olukowski/bevy_transform_interpolation" }
libm = { version = "0.2", optional = true }
approx = "0.5"
parry2d = { version = "0.26", optional = true }
parry2d-f64 = { version = "0.26", optional = true }
parry2d = { version = "0.27", optional = true }
parry2d-f64 = { version = "0.27", optional = true }
obvhs = { version = "0.3" }
serde = { version = "1", features = ["derive"], optional = true }
derive_more = "2"
Expand All @@ -102,8 +102,8 @@ disqualified = { version = "1.0" }

[dev-dependencies]
examples_common_2d = { path = "../examples_common_2d" }
bevy = { version = "0.18.0", default-features = false, features = ["2d", "ui"] }
bevy_heavy = { version = "0.4", features = ["approx"] }
bevy = { version = "0.19.0-rc.2",default-features = false, features = ["2d", "ui"] }
bevy_heavy = { git = "https://github.com/olukowski/bevy_heavy", features = ["approx"] }
glam = { version = "0.30", features = ["bytemuck"] }
bytemuck = "1.19"
criterion = { version = "0.8", features = ["html_reports"] }
Expand Down
22 changes: 11 additions & 11 deletions crates/avian3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ parry-f64 = ["f64", "dep:parry3d-f64", "default-collider"]
xpbd_joints = []

collider-from-mesh = ["bevy/bevy_mesh", "bevy/bevy_mikktspace", "3d"]
bevy_scene = ["bevy/bevy_scene"]
bevy_scene = ["bevy/bevy_world_serialization"]
bevy_picking = ["bevy/bevy_picking"]
serialize = [
"dep:serde",
Expand Down Expand Up @@ -79,18 +79,18 @@ bench = false

[dependencies]
avian_derive = { path = "../avian_derive", version = "0.2" }
bevy = { version = "0.18.0", default-features = false, features = [
bevy = { version = "0.19.0-rc.2", default-features = false, features = [
"std",
"bevy_log",
] }
bevy_math = { version = "0.18.0", features = ["approx"] }
glam_matrix_extras = { version = "0.2", features = ["bevy_reflect"] }
bevy_heavy = { version = "0.4" }
bevy_transform_interpolation = { version = "0.4" }
bevy_math = { version = "0.19.0-rc.2", features = ["approx"] }
glam_matrix_extras = { git = "https://github.com/olukowski/glam_matrix_extras", features = ["bevy_reflect"] }
bevy_heavy = { git = "https://github.com/olukowski/bevy_heavy" }
bevy_transform_interpolation = { git = "https://github.com/olukowski/bevy_transform_interpolation" }
libm = { version = "0.2", optional = true }
approx = "0.5"
parry3d = { version = "0.26", optional = true }
parry3d-f64 = { version = "0.26", optional = true }
parry3d = { version = "0.27", optional = true }
parry3d-f64 = { version = "0.27", optional = true }
obvhs = { version = "0.3" }
serde = { version = "1", features = ["derive"], optional = true }
derive_more = "2"
Expand All @@ -103,13 +103,13 @@ disqualified = { version = "1.0" }

[dev-dependencies]
examples_common_3d = { path = "../examples_common_3d" }
bevy = { version = "0.18.0", features = [
bevy = { version = "0.19.0-rc.2",features = [
"3d",
"ui",
"https",
"experimental_bevy_feathers",
"bevy_feathers",
] }
bevy_heavy = { version = "0.4", features = ["approx"] }
bevy_heavy = { git = "https://github.com/olukowski/bevy_heavy", features = ["approx"] }
criterion = { version = "0.8", features = ["html_reports"] }
bevy_mod_debugdump = { version = "0.15" }
rand = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion crates/examples_common_2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2024"
use-debug-plugin = []

[dependencies]
bevy = { version = "0.18.0", default-features = false, features = ["2d", "ui"] }
bevy = { version = "0.19.0-rc.2", default-features = false, features = ["2d", "ui"] }
avian2d = { path = "../avian2d", default-features = false, features = [
"diagnostic_ui",
] }
Expand Down
4 changes: 2 additions & 2 deletions crates/examples_common_2d/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Plugin for ExampleCommonPlugin {
(
toggle_diagnostics_ui.run_if(input_just_pressed(KeyCode::KeyU)),
toggle_paused.run_if(input_just_pressed(KeyCode::KeyP)),
step.run_if(physics_paused.and(input_just_pressed(KeyCode::Enter))),
step.run_if(physics_paused.and_then(input_just_pressed(KeyCode::Enter))),
),
);
}
Expand Down Expand Up @@ -72,7 +72,7 @@ fn setup_key_instructions(mut commands: Commands) {
commands.spawn((
Text::new("U: Diagnostics UI | P: Pause/Unpause | Enter: Step"),
TextFont {
font_size: 10.0,
font_size: FontSize::Px(10.0),
..default()
},
Node {
Expand Down
2 changes: 1 addition & 1 deletion crates/examples_common_3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2024"
use-debug-plugin = []

[dependencies]
bevy = { version = "0.18.0", default-features = false, features = ["3d", "ui"] }
bevy = { version = "0.19.0-rc.2", default-features = false, features = ["3d", "ui"] }
avian3d = { path = "../avian3d", default-features = false, features = [
"diagnostic_ui",
] }
Expand Down
4 changes: 2 additions & 2 deletions crates/examples_common_3d/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Plugin for ExampleCommonPlugin {
(
toggle_diagnostics_ui.run_if(input_just_pressed(KeyCode::KeyU)),
toggle_paused.run_if(input_just_pressed(KeyCode::KeyP)),
step.run_if(physics_paused.and(input_just_pressed(KeyCode::Enter))),
step.run_if(physics_paused.and_then(input_just_pressed(KeyCode::Enter))),
),
);
}
Expand Down Expand Up @@ -72,7 +72,7 @@ fn setup_key_instructions(mut commands: Commands) {
commands.spawn((
Text::new("U: Diagnostics UI | P: Pause/Unpause | Enter: Step"),
TextFont {
font_size: 10.0,
font_size: FontSize::Px(10.0),
..default()
},
Node {
Expand Down
2 changes: 1 addition & 1 deletion src/ancestor_marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<C: Component + TypePath> Plugin for AncestorMarkerPlugin<C> {
// until an ancestor that has other `AncestorMarker<C>` entities as children is encountered.
#[allow(clippy::type_complexity)]
app.add_observer(
|insert: On<Replace, (ChildOf, C)>,
|insert: On<Discard, (ChildOf, C)>,
mut commands: Commands,
collider_query: Query<&C>,
child_query: Query<&Children>,
Expand Down
8 changes: 4 additions & 4 deletions src/collider_tree/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ impl<C: AnyCollider> Plugin for ColliderTreeUpdatePlugin<C> {
);

// Cases 4
// Note: We use `Replace` here to run before Case 2.
// Note: We use `Discard` here to run before Case 2.
app.add_observer(
add_to_tree_on::<Replace, Disabled, (Without<ColliderDisabled>, Allow<Disabled>)>,
add_to_tree_on::<Discard, Disabled, (Without<ColliderDisabled>, Allow<Disabled>)>,
);
app.add_observer(add_to_tree_on::<Replace, ColliderDisabled, ()>);
app.add_observer(add_to_tree_on::<Discard, ColliderDisabled, ()>);

// Case 5
app.add_observer(
Expand Down Expand Up @@ -371,7 +371,7 @@ impl<C: AnyCollider> Plugin for ColliderTreeUpdatePlugin<C> {

// Case 11
app.add_observer(
|trigger: On<Replace, RigidBodyDisabled>,
|trigger: On<Discard, RigidBodyDisabled>,
body_query: Query<(&RigidBodyColliders, Has<RigidBodyDisabled>)>,
mut collider_query: Query<&ColliderTreeProxyKey, Without<ColliderDisabled>>,
mut trees: ResMut<ColliderTrees>| {
Expand Down
5 changes: 4 additions & 1 deletion src/collision/collider/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ use crate::{
prelude::*,
};
#[cfg(all(feature = "bevy_scene", feature = "default-collider"))]
use bevy::scene::SceneInstance;
use bevy::world_serialization::{
WorldAssetRoot as SceneRoot, WorldInstance as SceneInstance,
WorldInstanceSpawner as SceneSpawner,
};
use bevy::{
ecs::{intern::Interned, schedule::ScheduleLabel},
prelude::*,
Expand Down
34 changes: 15 additions & 19 deletions src/collision/collider/collider_hierarchy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use bevy::{
///
/// [`Relationship`]: bevy::ecs::relationship::Relationship
#[derive(Component, Clone, Copy, Debug, PartialEq, Eq, Reflect)]
#[component(immutable, on_insert = <ColliderOf as Relationship>::on_insert, on_replace = <ColliderOf as Relationship>::on_replace)]
#[component(immutable, on_insert = <ColliderOf as Relationship>::on_insert, on_discard = <ColliderOf as Relationship>::on_discard)]
#[require(ColliderTransform)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serialize", reflect(Serialize, Deserialize))]
Expand All @@ -69,6 +69,8 @@ impl FromWorld for ColliderOf {
impl Relationship for ColliderOf {
type RelationshipTarget = RigidBodyColliders;

const ALLOW_SELF_REFERENTIAL: bool = true;

fn get(&self) -> Entity {
self.body
}
Expand Down Expand Up @@ -145,7 +147,7 @@ impl Relationship for ColliderOf {
}
}

fn on_replace(
fn on_discard(
mut world: DeferredWorld,
HookContext {
entity,
Expand Down Expand Up @@ -173,23 +175,17 @@ impl Relationship for ColliderOf {
relationship_target.collection_mut_risky(),
entity,
);
if relationship_target.is_empty()
&& let Ok(mut entity) = world.commands().get_entity(body)
{
// this "remove" operation must check emptiness because in the event that an identical
// relationship is inserted on top, this despawn would result in the removal of that identical
// relationship ... not what we want!
entity.queue_handled(
|mut entity: EntityWorldMut| {
if entity
.get::<Self::RelationshipTarget>()
.is_some_and(RelationshipTarget::is_empty)
{
entity.remove::<Self::RelationshipTarget>();
}
},
|_, _| {},
);
if relationship_target.is_empty() {
let command = |mut entity: EntityWorldMut| {
if entity
.get::<Self::RelationshipTarget>()
.is_some_and(RelationshipTarget::is_empty)
{
entity.remove::<Self::RelationshipTarget>();
}
};

world.commands().queue_silenced(command.with_entity(body));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/collision/collider/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use itertools::Either;
///
/// In contrast to [`ColliderConstructor`], this component will *not* generate a collider on its own entity.
///
/// If this component is used on a scene, such as one spawned by a [`SceneRoot`], it will
/// If this component is used on a scene, such as one spawned by a `SceneRoot`, it will
/// wait until the scene is loaded before generating colliders. Note that this requires
/// the `bevy_scene` feature to be enabled.
///
Expand Down
2 changes: 1 addition & 1 deletion src/collision/collider/parry/contact_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ pub fn contact_manifolds(
prediction_distance,
)
{
let normal = rotation1 * contact.normal1;
let normal: Vector = rotation1 * contact.normal1;

// Make sure the normal is valid
if !normal.is_normalized() {
Expand Down
Loading
Loading