Update to Parry 0.18 (#770)

* update to parry ~main

* use traverse_depth_first

* add example to test intersection

* rely on upstream PR rather than local

* re-enable profiler_ui for examples

* rely on official parry repository

* chore: switch back to the published version of parry

* chore: update changelog

* chore: remove dead code

* fix compilation of rapier3d-meshloader and rapier3d-urdf

* chore: cargo fmt

---------

Co-authored-by: Sébastien Crozet <sebcrozet@dimforge.com>
This commit is contained in:
Thierry Berger
2025-01-08 17:16:34 +01:00
committed by GitHub
parent cf77b5bf57
commit dc4bd24da8
26 changed files with 129 additions and 45 deletions

View File

@@ -68,7 +68,7 @@ vec_map = { version = "0.8", optional = true }
web-time = { version = "1.1", optional = true }
num-traits = "0.2"
nalgebra = "0.33"
parry2d-f64 = "0.17.0"
parry2d-f64 = "0.18.0"
simba = "0.9"
approx = "0.5"
rayon = { version = "1", optional = true }

View File

@@ -68,7 +68,7 @@ vec_map = { version = "0.8", optional = true }
web-time = { version = "1.1", optional = true }
num-traits = "0.2"
nalgebra = "0.33"
parry2d = "0.17.0"
parry2d = "0.18.0"
simba = "0.9"
approx = "0.5"
rayon = { version = "1", optional = true }

View File

@@ -71,7 +71,7 @@ vec_map = { version = "0.8", optional = true }
web-time = { version = "1.1", optional = true }
num-traits = "0.2"
nalgebra = "0.33"
parry3d-f64 = "0.17.0"
parry3d-f64 = "0.18.0"
simba = "0.9"
approx = "0.5"
rayon = { version = "1", optional = true }

View File

@@ -27,6 +27,6 @@ wavefront = ["mesh-loader/obj"]
[dependencies]
thiserror = "1.0.61"
profiling = "1.0"
mesh-loader = { version = "0.1.12", optional = true }
mesh-loader = "0.1.12"
rapier3d = { version = "0.22", path = "../rapier3d" }

View File

@@ -19,9 +19,11 @@ license = "Apache-2.0"
edition = "2021"
[features]
stl = ["dep:rapier3d-meshloader", "rapier3d-meshloader/stl"]
collada = ["dep:rapier3d-meshloader", "rapier3d-meshloader/collada"]
wavefront = ["dep:rapier3d-meshloader", "rapier3d-meshloader/wavefront"]
stl = ["dep:rapier3d-meshloader", "rapier3d-meshloader/stl", "__meshloader_is_enabled"]
collada = ["dep:rapier3d-meshloader", "rapier3d-meshloader/collada", "__meshloader_is_enabled"]
wavefront = ["dep:rapier3d-meshloader", "rapier3d-meshloader/wavefront", "__meshloader_is_enabled"]
## Private feature for detecting when meshloader is enabled by any of the file type features above.
__meshloader_is_enabled = []
[dependencies]
log = "0.4"

View File

@@ -37,7 +37,6 @@ use rapier3d::{
geometry::{Collider, ColliderBuilder, ColliderHandle, ColliderSet, SharedShape, TriMeshFlags},
math::{Isometry, Point, Real, Vector},
na,
prelude::MeshConverter,
};
use std::collections::HashMap;
use std::path::Path;
@@ -462,7 +461,7 @@ fn urdf_to_rigid_body(options: &UrdfLoaderOptions, inertial: &Inertial) -> Rigid
fn urdf_to_colliders(
options: &UrdfLoaderOptions,
mesh_dir: &Path,
_mesh_dir: &Path, // Unused if none of the meshloader features is enabled.
geometry: &Geometry,
origin: &Pose,
) -> Vec<Collider> {
@@ -496,14 +495,20 @@ fn urdf_to_colliders(
Geometry::Sphere { radius } => {
colliders.push(SharedShape::ball(*radius as Real));
}
#[cfg(not(feature = "__meshloader_is_enabled"))]
Geometry::Mesh { .. } => {
log::error!("Mesh loading is disabled by default. Enable one of the format features (`stl`, `collada`, `wavefront`) of `rapier3d-urdf` for mesh support.");
}
#[cfg(feature = "__meshloader_is_enabled")]
Geometry::Mesh { filename, scale } => {
let full_path = mesh_dir.join(filename);
let full_path = _mesh_dir.join(filename);
let scale = scale
.map(|s| Vector::new(s[0] as Real, s[1] as Real, s[2] as Real))
.unwrap_or_else(|| Vector::<Real>::repeat(1.0));
let Ok(loaded_mesh) = rapier3d_meshloader::load_from_path(
full_path,
&MeshConverter::TriMeshWithFlags(options.trimesh_flags),
&rapier3d::prelude::MeshConverter::TriMeshWithFlags(options.trimesh_flags),
scale,
) else {
return Vec::new();

View File

@@ -71,7 +71,7 @@ vec_map = { version = "0.8", optional = true }
web-time = { version = "1.1", optional = true }
num-traits = "0.2"
nalgebra = "0.33"
parry3d = "0.17.0"
parry3d = "0.18.0"
simba = "0.9"
approx = "0.5"
rayon = { version = "1", optional = true }

View File

@@ -34,12 +34,12 @@ default = ["dim2"]
dim2 = []
parallel = ["rapier/parallel", "num_cpus"]
other-backends = ["wrapped2d"]
profiling = ["dep:puffin_egui", "profiling/profile-with-puffin"]
profiler_ui = ["dep:puffin_egui", "profiling/profile-with-puffin"]
# See https://github.com/dimforge/rapier/issues/760.
unstable-puffin-pr-235 = []
[package.metadata.docs.rs]
features = ["parallel", "profiling"]
features = ["parallel", "profiler_ui"]
[lints.clippy]
needless_lifetimes = "allow"

View File

@@ -34,12 +34,12 @@ default = ["dim2"]
dim2 = []
parallel = ["rapier/parallel", "num_cpus"]
other-backends = ["wrapped2d"]
profiling = ["dep:puffin_egui", "profiling/profile-with-puffin"]
profiler_ui = ["dep:puffin_egui", "profiling/profile-with-puffin"]
# See https://github.com/dimforge/rapier/issues/760.
unstable-puffin-pr-235 = []
[package.metadata.docs.rs]
features = ["parallel", "other-backends", "profiling"]
features = ["parallel", "other-backends", "profiler_ui"]
[lints.clippy]
needless_lifetimes = "allow"

View File

@@ -36,12 +36,12 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = [
default = ["dim3"]
dim3 = []
parallel = ["rapier/parallel", "num_cpus"]
profiling = ["dep:puffin_egui", "profiling/profile-with-puffin"]
profiler_ui = ["dep:puffin_egui", "profiling/profile-with-puffin"]
# See https://github.com/dimforge/rapier/issues/760.
unstable-puffin-pr-235 = []
[package.metadata.docs.rs]
features = ["parallel", "profiling"]
features = ["parallel", "profiler_ui"]
[lints.clippy]
needless_lifetimes = "allow"

View File

@@ -34,12 +34,12 @@ default = ["dim3"]
dim3 = []
parallel = ["rapier/parallel", "num_cpus"]
other-backends = ["physx", "physx-sys", "glam"]
profiling = ["dep:puffin_egui", "profiling/profile-with-puffin"]
profiler_ui = ["dep:puffin_egui", "profiling/profile-with-puffin"]
# See https://github.com/dimforge/rapier/issues/760.
unstable-puffin-pr-235 = []
[package.metadata.docs.rs]
features = ["parallel", "other-backends", "profiling"]
features = ["parallel", "other-backends", "profiler_ui"]
[lints.clippy]
needless_lifetimes = "allow"