Skip to content

Commit

Permalink
Merge branch 'master' into debug_visible
Browse files Browse the repository at this point in the history
  • Loading branch information
barsoosayque authored Jul 15, 2024
2 parents 64b2ce0 + d190a1c commit 18f913f
Show file tree
Hide file tree
Showing 57 changed files with 956 additions and 370 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ name: Rust

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

env:
CARGO_TERM_COLOR: always
RUST_CACHE_KEY: rust-cache-20240701
CARGO_PROFILE_DEV_DEBUG: none

jobs:
check-fmt:
Expand All @@ -19,6 +21,18 @@ jobs:
components: rustfmt
- name: Check formatting
run: cargo fmt -- --check
doc:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ env.RUST_CACHE_KEY }}
- name: Cargo doc
run: cargo doc
test:
runs-on: ubuntu-latest
env:
Expand All @@ -29,6 +43,8 @@ jobs:
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ env.RUST_CACHE_KEY }}
- run: sudo apt update && sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
- name: Clippy for bevy_rapier2d
run: cargo clippy --verbose -p bevy_rapier2d
Expand All @@ -53,6 +69,8 @@ jobs:
components: clippy
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ env.RUST_CACHE_KEY }}
- name: Clippy bevy_rapier2d
run: cd bevy_rapier2d && cargo clippy --verbose --features wasm-bindgen,bevy/webgl2 --target wasm32-unknown-unknown
- name: Clippy bevy_rapier3d
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,42 @@

### Added

- Added a `TriMeshFlags` parameter for `ComputedColliderShape`,
its default value is `TriMeshFlags::MERGE_DUPLICATE_VERTICES`,
which was its hardcoded behaviour.

## v0.27.0 (07 July 2024)

**This is an update from rapier 0.19 to Rapier 0.21 which includes several stability improvements
and new features. Please have a look at the
[0.20 and 0.21 changelogs](https://github.com/dimforge/rapier/blob/master/CHANGELOG.md) of Rapier.**

### Modified

- Update from rapier `0.19` to rapier `0.21`.
- Update to nalgebra `0.33`.
- Update to bevy `0.14`.
- Renamed `has_any_active_contacts` to `has_any_active_contact` for better consistency with rapier.
- `ColliderDebugColor`'s property is now a `bevy::color::Hsla`.
- `ImpulseJoint::data` and `MultibodyJoint::data` are now a more detailed enum `TypedJoint` instead of a `GenericJoint`.
You can still access its inner `GenericJoint` with `.as_ref()` or `as_mut()`.
- `data` fields from all joints (`FixedJoint`, …) are now public, and their getters removed.

### Added

- Derive `Debug` for `LockedAxes`.
- Expose `is_sliding_down_slope` to both `MoveShapeOutput` and `KinematicCharacterControllerOutput`.
- Added a way to configure which colliders should be debug rendered: `global` parameter for both
`RapierDebugColliderPlugin` and `DebugRenderContext`, as well as individual collider setup via
a `ColliderDebug` component.
- Added a First Person Shooter `character_controller` example for `bevy_rapier3d`.
- Added serialization support for `CollisionGroups`, `SolverGroups`, `ContactForceEventThreshold`, `ContactSkin`.
- Added `RapierContext::context.impulse_revolute_joint_angle` to compute the angle along a revolute joint’s principal axis.

### Fix

- Fix rigidbodies never going to sleep when a scale was applied to their `Transform`.
- Fix losing information about hit details when converting from `ShapeCastHit` in parry to `ShapeCastHit` in bevy_rapier

## v0.26.0 (05 May 2024)

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ codegen-units = 1
#parry2d = { git = "https://github.com/dimforge/parry", branch = "master" }
#parry3d = { git = "https://github.com/dimforge/parry", branch = "master" }
#rapier2d = { git = "https://github.com/dimforge/rapier", branch = "character-controller" }
#rapier3d = { git = "https://github.com/dimforge/rapier", branch = "character-controller" }
#rapier3d = { git = "https://github.com/dimforge/rapier", branch = "character-controller" }
31 changes: 23 additions & 8 deletions bevy_rapier2d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_rapier2d"
version = "0.26.0"
version = "0.27.0"
authors = ["Sébastien Crozet <[email protected]>"]
description = "2-dimensional physics engine in Rust, official Bevy plugin."
documentation = "http://docs.rs/bevy_rapier2d"
Expand All @@ -20,8 +20,20 @@ required-features = ["dim2"]
[features]
default = ["dim2", "async-collider", "debug-render-2d"]
dim2 = []
debug-render-2d = ["bevy/bevy_core_pipeline", "bevy/bevy_sprite", "bevy/bevy_gizmos", "rapier2d/debug-render", "bevy/bevy_asset"]
debug-render-3d = ["bevy/bevy_core_pipeline", "bevy/bevy_pbr", "bevy/bevy_gizmos", "rapier2d/debug-render", "bevy/bevy_asset"]
debug-render-2d = [
"bevy/bevy_core_pipeline",
"bevy/bevy_sprite",
"bevy/bevy_gizmos",
"rapier2d/debug-render",
"bevy/bevy_asset",
]
debug-render-3d = [
"bevy/bevy_core_pipeline",
"bevy/bevy_pbr",
"bevy/bevy_gizmos",
"rapier2d/debug-render",
"bevy/bevy_asset",
]
parallel = ["rapier2d/parallel"]
simd-stable = ["rapier2d/simd-stable"]
simd-nightly = ["rapier2d/simd-nightly"]
Expand All @@ -32,18 +44,21 @@ headless = []
async-collider = ["bevy/bevy_asset", "bevy/bevy_scene"]

[dependencies]
bevy = { version = "0.13", default-features = false }
nalgebra = { version = "0.32.3", features = ["convert-glam025"] }
rapier2d = "0.19.0"
bevy = { version = "0.14", default-features = false }
nalgebra = { version = "0.33", features = ["convert-glam027"] }
rapier2d = "0.21"
bitflags = "2.4"
log = "0.4"
serde = { version = "1", features = ["derive"], optional = true }

[dev-dependencies]
bevy = { version = "0.13", default-features = false, features = ["x11"] }
bevy = { version = "0.14", default-features = false, features = [
"x11",
"bevy_state",
] }
oorandom = "11"
approx = "0.5.1"
glam = { version = "0.25", features = ["approx"] }
glam = { version = "0.27", 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_rapier2d/examples/boxes2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_rapier2d::prelude::*;

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down
4 changes: 2 additions & 2 deletions bevy_rapier2d/examples/contact_filter2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl BevyPhysicsHooks for SameUserDataFilter<'_, '_> {

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down Expand Up @@ -80,7 +80,7 @@ pub fn setup_physics(mut commands: Commands) {
let centery = shift / 2.0;
let mut group_id = 0;
let tags = [CustomFilterTag::GroupA, CustomFilterTag::GroupB];
let colors = [Color::hsl(220.0, 1.0, 0.3), Color::hsl(260.0, 1.0, 0.7)];
let colors = [Hsla::hsl(220.0, 1.0, 0.3), Hsla::hsl(260.0, 1.0, 0.7)];

for i in 0..num {
for j in 0usize..num * 5 {
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/custom_system_setup2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bevy_rapier2d::prelude::*;
fn main() {
let mut app = App::new();

app.insert_resource(ClearColor(Color::rgb(
app.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down
9 changes: 4 additions & 5 deletions bevy_rapier2d/examples/debug_despawn2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bevy_rapier2d::prelude::*;
fn main() {
App::new()
.init_resource::<Game>()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.0)))
.insert_resource(ClearColor(Color::srgb(0.0, 0.0, 0.0)))
.add_plugins((
DefaultPlugins,
RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(100.0),
Expand Down Expand Up @@ -76,7 +76,7 @@ impl Default for Game {
}

fn byte_rgb(r: u8, g: u8, b: u8) -> Color {
Color::rgb(r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0)
Color::srgb(r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0)
}

pub fn setup_game(mut commands: Commands, mut game: ResMut<Game>) {
Expand Down Expand Up @@ -133,7 +133,7 @@ fn setup_board(commands: &mut Commands, game: &Game) {
commands.spawn((
SpriteBundle {
sprite: Sprite {
color: Color::rgb(0.5, 0.5, 0.5),
color: Color::srgb(0.5, 0.5, 0.5),
custom_size: Some(Vec2::new(game.n_lanes as f32 * 30.0, 60.0)),
..Default::default()
},
Expand Down Expand Up @@ -174,8 +174,7 @@ fn spawn_cube(commands: &mut Commands, game: &mut Game) {
block_entities[*i],
RevoluteJointBuilder::new()
.local_anchor1(anchor_1)
.local_anchor2(anchor_2)
.build(),
.local_anchor2(anchor_2),
))
.id();
game.current_cube_joints.push(id);
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/despawn2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub struct ResizeResource {

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/events2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_rapier2d::prelude::*;

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/joints2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_rapier2d::prelude::*;

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/joints_despawn2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct DespawnResource {

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/locked_rotations2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_rapier2d::prelude::*;

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/multiple_colliders2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_rapier2d::prelude::*;

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
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 @@ -35,7 +35,7 @@ pub fn spawn_player(mut commands: Commands, mut rapier_config: ResMut<RapierConf
commands.spawn((
SpriteBundle {
sprite: Sprite {
color: Color::rgb(0.0, 0.0, 0.0),
color: Color::srgb(0.0, 0.0, 0.0),
custom_size: Some(Vec2::new(sprite_size, sprite_size)),
..Default::default()
},
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/rope_joint2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_rapier2d::prelude::*;

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down
32 changes: 24 additions & 8 deletions bevy_rapier3d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_rapier3d"
version = "0.26.0"
version = "0.27.0"
authors = ["Sébastien Crozet <[email protected]>"]
description = "3-dimensional physics engine in Rust, official Bevy plugin."
documentation = "http://docs.rs/bevy_rapier3d"
Expand All @@ -21,8 +21,20 @@ required-features = ["dim3"]
default = ["dim3", "async-collider", "debug-render-3d"]
dim3 = []
debug-render = ["debug-render-3d"]
debug-render-2d = ["bevy/bevy_core_pipeline", "bevy/bevy_sprite", "bevy/bevy_gizmos", "rapier3d/debug-render", "bevy/bevy_asset"]
debug-render-3d = ["bevy/bevy_core_pipeline", "bevy/bevy_pbr", "bevy/bevy_gizmos", "rapier3d/debug-render", "bevy/bevy_asset"]
debug-render-2d = [
"bevy/bevy_core_pipeline",
"bevy/bevy_sprite",
"bevy/bevy_gizmos",
"rapier3d/debug-render",
"bevy/bevy_asset",
]
debug-render-3d = [
"bevy/bevy_core_pipeline",
"bevy/bevy_pbr",
"bevy/bevy_gizmos",
"rapier3d/debug-render",
"bevy/bevy_asset",
]
parallel = ["rapier3d/parallel"]
simd-stable = ["rapier3d/simd-stable"]
simd-nightly = ["rapier3d/simd-nightly"]
Expand All @@ -33,17 +45,21 @@ headless = []
async-collider = ["bevy/bevy_asset", "bevy/bevy_scene"]

[dependencies]
bevy = { version = "0.13", default-features = false }
nalgebra = { version = "0.32.3", features = ["convert-glam025"] }
rapier3d = "0.19"
bevy = { version = "0.14", default-features = false }
nalgebra = { version = "0.33", features = ["convert-glam027"] }
rapier3d = "0.21"
bitflags = "2.4"
log = "0.4"
serde = { version = "1", features = ["derive"], optional = true }

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

[package.metadata.docs.rs]
# Enable all the features when building the docs on docs.rs
Expand Down
8 changes: 4 additions & 4 deletions bevy_rapier3d/examples/boxes3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use bevy_rapier3d::prelude::*;

fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(
.insert_resource(ClearColor(Color::srgb(
0xF9 as f32 / 255.0,
0xF9 as f32 / 255.0,
0xFF as f32 / 255.0,
Expand Down Expand Up @@ -51,9 +51,9 @@ pub fn setup_physics(mut commands: Commands) {
let mut offset = -(num as f32) * (rad * 2.0 + rad) * 0.5;
let mut color = 0;
let colors = [
Color::hsl(220.0, 1.0, 0.3),
Color::hsl(180.0, 1.0, 0.3),
Color::hsl(260.0, 1.0, 0.7),
Hsla::hsl(220.0, 1.0, 0.3),
Hsla::hsl(180.0, 1.0, 0.3),
Hsla::hsl(260.0, 1.0, 0.7),
];

for j in 0usize..20 {
Expand Down
Loading

0 comments on commit 18f913f

Please sign in to comment.