Skip to content
Merged
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
10 changes: 5 additions & 5 deletions bevy_rapier2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ async-collider = [
to-bevy-mesh = ["bevy/bevy_render", "bevy/bevy_asset"]

[dependencies]
bevy = { version = "0.18.0", default-features = false, features = ["std"] }
nalgebra = { version = "0.34.1", features = ["convert-glam030"] }
rapier2d = "0.31.0"
bevy = { version = "0.18.1", default-features = false, features = ["std"] }
nalgebra = { version = "0.34.2", features = ["convert-glam030"] }
rapier2d = "0.32.0"
bitflags = "2.10.0"
log = "0.4"
serde = { version = "1", features = ["derive"], optional = true }

[dev-dependencies]
bevy = { version = "0.18.0", default-features = false, features = [
bevy = { version = "0.18.1", default-features = false, features = [
"x11",
"bevy_state",
"bevy_window",
Expand All @@ -94,7 +94,7 @@ oorandom = "11"
approx = "0.5.1"
glam = { version = "0.30.9", features = ["approx"] }
bevy-inspector-egui = "0.36.0"
bevy_egui = "0.39.0"
bevy_egui = "0.39.1"
bevy_mod_debugdump = "0.15.0"
serde_json = "1.0"

Expand Down
10 changes: 5 additions & 5 deletions bevy_rapier3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ async-collider = [
to-bevy-mesh = ["bevy/bevy_render", "bevy/bevy_asset"]

[dependencies]
bevy = { version = "0.18.0", default-features = false, features = ["std"] }
nalgebra = { version = "0.34.1", features = ["convert-glam030"] }
rapier3d = "0.31.0"
bevy = { version = "0.18.1", default-features = false, features = ["std"] }
nalgebra = { version = "0.34.2", features = ["convert-glam030"] }
rapier3d = "0.32.0"
bitflags = "2.10.0"
log = "0.4"
serde = { version = "1", features = ["derive"], optional = true }

[dev-dependencies]
bevy = { version = "0.18.0", default-features = false, features = [
bevy = { version = "0.18.1", default-features = false, features = [
"bevy_window",
"x11",
"tonemapping_luts",
Expand All @@ -88,7 +88,7 @@ bevy = { version = "0.18.0", default-features = false, features = [
approx = "0.5.1"
glam = { version = "0.30.9", features = ["approx"] }
bevy-inspector-egui = "0.36.0"
bevy_egui = "0.39.0"
bevy_egui = "0.39.1"
bevy_mod_debugdump = "0.15.0"

[package.metadata.docs.rs]
Expand Down
4 changes: 2 additions & 2 deletions bevy_rapier3d/examples/voxels3.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bevy::prelude::*;
use bevy_rapier3d::prelude::*;
use rapier3d::math::Isometry;
use rapier3d::math::Pose;

fn main() {
App::new()
Expand Down Expand Up @@ -58,7 +58,7 @@ pub fn setup_physics(mut commands: Commands) {
}
let collider = Collider::voxels_from_points(voxel_size, &samples);
let ground_position = Vec3::new(voxel_size.x / 2f32, 0.0, voxel_size.z / 2f32);
let floor_aabb = collider.raw.compute_aabb(&Isometry::identity());
let floor_aabb = collider.raw.compute_aabb(&Pose::IDENTITY);
commands.spawn((Transform::from_translation(ground_position), collider));

/*
Expand Down
4 changes: 2 additions & 2 deletions bevy_rapier_benches3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rapier3d = "0.31.0"
rapier3d = "0.32.0"
bevy_rapier3d = { version = "0.33", path = "../bevy_rapier3d" }
bevy = { version = "0.18.0", default-features = false }
bevy = { version = "0.18.1", default-features = false }

[dev-dependencies]
divan = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion ci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
bevy = "0.18.0"
bevy = "0.18.1"
bevy_rapier3d = { version = "0.33", path = "../bevy_rapier3d" }
bevy_rapier2d = { version = "0.33", path = "../bevy_rapier2d" }

Expand Down
18 changes: 11 additions & 7 deletions src/control/character_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ impl CharacterCollision {
RapierContextColliders::collider_entity_with_set(colliders, c.handle).map(|entity| {
CharacterCollision {
entity,
character_translation: c.character_pos.translation.vector.into(),
character_translation: c.character_pos.translation,
#[cfg(feature = "dim2")]
character_rotation: c.character_pos.rotation.angle(),
#[cfg(feature = "dim3")]
character_rotation: c.character_pos.rotation.into(),
translation_applied: c.translation_applied.into(),
translation_remaining: c.translation_remaining.into(),
character_rotation: c.character_pos.rotation,
translation_applied: c.translation_applied,
translation_remaining: c.translation_remaining,
hit: ShapeCastHit::from_rapier(c.hit, details_always_computed),
}
})
Expand Down Expand Up @@ -93,7 +93,7 @@ impl Default for MoveShapeOptions {
fn default() -> Self {
let def = rapier::control::KinematicCharacterController::default();
Self {
up: def.up.into(),
up: def.up,
offset: def.offset,
slide: def.slide,
autostep: def.autostep,
Expand Down Expand Up @@ -167,8 +167,12 @@ impl KinematicCharacterController {
include_dynamic_bodies: autostep.include_dynamic_bodies,
});

if self.up.length_squared() < 1.0e-12 {
return None;
}

Some(rapier::control::KinematicCharacterController {
up: self.up.try_into().ok()?,
up: self.up.normalize(),
offset: self.offset,
slide: self.slide,
autostep,
Expand All @@ -187,7 +191,7 @@ impl Default for KinematicCharacterController {
translation: None,
custom_shape: None,
custom_mass: None,
up: def.up.into(),
up: def.up,
offset: def.offset,
slide: def.slide,
autostep: def.autostep,
Expand Down
28 changes: 14 additions & 14 deletions src/dynamics/generic_joint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ impl GenericJoint {
#[cfg(feature = "dim2")]
return self.raw.local_frame1.rotation.angle();
#[cfg(feature = "dim3")]
return self.raw.local_frame1.rotation.into();
return self.raw.local_frame1.rotation;
}

/// Sets the joint’s frame, expressed in the first rigid-body’s local-space.
pub fn set_local_basis1(&mut self, local_basis: Rot) -> &mut Self {
#[cfg(feature = "dim2")]
{
self.raw.local_frame1.rotation = na::UnitComplex::new(local_basis);
self.raw.local_frame1.rotation = rapier::math::Rot2::new(local_basis);
}
#[cfg(feature = "dim3")]
{
self.raw.local_frame1.rotation = local_basis.into();
self.raw.local_frame1.rotation = local_basis;
}
self
}
Expand All @@ -77,67 +77,67 @@ impl GenericJoint {
#[cfg(feature = "dim2")]
return self.raw.local_frame2.rotation.angle();
#[cfg(feature = "dim3")]
return self.raw.local_frame2.rotation.into();
return self.raw.local_frame2.rotation;
}

/// Sets the joint’s frame, expressed in the second rigid-body’s local-space.
pub fn set_local_basis2(&mut self, local_basis: Rot) -> &mut Self {
#[cfg(feature = "dim2")]
{
self.raw.local_frame2.rotation = na::UnitComplex::new(local_basis);
self.raw.local_frame2.rotation = rapier::math::Rot2::new(local_basis);
}
#[cfg(feature = "dim3")]
{
self.raw.local_frame2.rotation = local_basis.into();
self.raw.local_frame2.rotation = local_basis;
}
self
}

/// The principal (local X) axis of this joint, expressed in the first rigid-body’s local-space.
#[must_use]
pub fn local_axis1(&self) -> Vect {
(*self.raw.local_axis1()).into()
self.raw.local_axis1()
}

/// Sets the principal (local X) axis of this joint, expressed in the first rigid-body’s local-space.
pub fn set_local_axis1(&mut self, local_axis: Vect) -> &mut Self {
self.raw.set_local_axis1(local_axis.try_into().unwrap());
self.raw.set_local_axis1(local_axis.normalize());
self
}

/// The principal (local X) axis of this joint, expressed in the second rigid-body’s local-space.
#[must_use]
pub fn local_axis2(&self) -> Vect {
(*self.raw.local_axis2()).into()
self.raw.local_axis2()
}

/// Sets the principal (local X) axis of this joint, expressed in the second rigid-body’s local-space.
pub fn set_local_axis2(&mut self, local_axis: Vect) -> &mut Self {
self.raw.set_local_axis2(local_axis.try_into().unwrap());
self.raw.set_local_axis2(local_axis.normalize());
self
}

/// The anchor of this joint, expressed in the first rigid-body’s local-space.
#[must_use]
pub fn local_anchor1(&self) -> Vect {
self.raw.local_anchor1().into()
self.raw.local_anchor1()
}

/// Sets anchor of this joint, expressed in the first rigid-body’s local-space.
pub fn set_local_anchor1(&mut self, anchor1: Vect) -> &mut Self {
self.raw.set_local_anchor1(anchor1.into());
self.raw.set_local_anchor1(anchor1);
self
}

/// The anchor of this joint, expressed in the second rigid-body’s local-space.
#[must_use]
pub fn local_anchor2(&self) -> Vect {
self.raw.local_anchor2().into()
self.raw.local_anchor2()
}

/// Sets anchor of this joint, expressed in the second rigid-body’s local-space.
pub fn set_local_anchor2(&mut self, anchor2: Vect) -> &mut Self {
self.raw.set_local_anchor2(anchor2.into());
self.raw.set_local_anchor2(anchor2);
self
}

Expand Down
18 changes: 9 additions & 9 deletions src/dynamics/rigid_body.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::math::Vect;
use bevy::prelude::*;
use rapier::prelude::{
Isometry, LockedAxes as RapierLockedAxes, RigidBodyActivation, RigidBodyHandle, RigidBodyType,
LockedAxes as RapierLockedAxes, Pose, RigidBodyActivation, RigidBodyHandle, RigidBodyType,
};
use std::ops::{Add, AddAssign, Sub, SubAssign};

Expand Down Expand Up @@ -244,7 +244,7 @@ impl MassProperties {
#[cfg(feature = "dim2")]
pub fn into_rapier(self) -> rapier::dynamics::MassProperties {
rapier::dynamics::MassProperties::new(
self.local_center_of_mass.into(),
self.local_center_of_mass,
self.mass,
#[allow(clippy::useless_conversion)] // Need to convert if dim3 enabled
self.principal_inertia.into(),
Expand All @@ -255,10 +255,10 @@ impl MassProperties {
#[cfg(feature = "dim3")]
pub fn into_rapier(self) -> rapier::dynamics::MassProperties {
rapier::dynamics::MassProperties::with_principal_inertia_frame(
self.local_center_of_mass.into(),
self.local_center_of_mass,
self.mass,
self.principal_inertia.into(),
self.principal_inertia_local_frame.into(),
self.principal_inertia,
self.principal_inertia_local_frame,
)
}

Expand Down Expand Up @@ -588,16 +588,16 @@ impl Default for Damping {
#[derive(Copy, Clone, Debug, Default, PartialEq, Component)]
pub struct TransformInterpolation {
/// The starting point of the interpolation.
pub start: Option<Isometry<f32>>,
pub start: Option<Pose>,
/// The end point of the interpolation.
pub end: Option<Isometry<f32>>,
pub end: Option<Pose>,
}

impl TransformInterpolation {
/// Interpolates between the start and end positions with `t` in the range `[0..1]`.
pub fn lerp_slerp(&self, t: f32) -> Option<Isometry<f32>> {
pub fn lerp_slerp(&self, t: f32) -> Option<Pose> {
if let (Some(start), Some(end)) = (self.start, self.end) {
Some(start.lerp_slerp(&end, t))
Some(start.lerp(&end, t))
} else {
None
}
Expand Down
Loading
Loading