dimforge / dimforge/rapier

Unsupported collisions between Trimesh and Custom

Open
#773 6 comments 0 reactions 0 assignees View on GitHub
A-Geometry C-Enhancement D-Medium P-High
Dominant language
Rust
Stars
5.7k
Forks
387
Avg merge
4d 23h
Merged PRs (30d)
6

Description

I'm implementing a custom collider, which is essentially a heightmap over a cylinder surface. Got stuck for not seeing `project_local_point` being called, and decided to debug Rapier a bit. Reached to this step:
```
parry3d::query::default_query_dispatcher::impl$1::contact_manifold_convex_convex(*mut parry3d::query::default_query_dispatcher::DefaultQueryDispatcher,*mut nalgebra::geometry::isometry::Isometry >,3>,ref$ >,ref$ >,enum2$ > > >,enum2$ > > >,f32,*mut parry3d::query::contact_manifolds::contact_manifold::ContactManifold) default_query_dispatcher.rs:599
parry3d::query::contact_manifolds::contact_manifolds_trimesh_shape::contact_manifolds_trimesh_shape(ref$ > >,*mut nalgebra::geometry::isometry::Isometry >,3>,*mut parry3d::shape::trimesh::TriMesh,ref$ >,f32,*mut alloc::vec::Vec,alloc::alloc::Global>,*mut enum2$ >,bool) contact_manifolds_trimesh_shape.rs:195
parry3d::query::contact_manifolds::contact_manifolds_trimesh_shape::contact_manifolds_trimesh_shape_shapes(ref$ > >,*mut nalgebra::geometry::isometry::Isometry >,3>,ref$ >,ref$ >,f32,*mut alloc::vec::Vec,alloc::alloc::Global>,*mut enum2$ >) contact_manifolds_trimesh_shape.rs:59
parry3d::query::default_query_dispatcher::impl$1::contact_manifolds(*mut parry3d::query::default_query_dispatcher::DefaultQueryDispatcher,*mut nalgebra::geometry::isometry::Isometry >,3>,ref$ >,ref$ >,f32,*mut alloc::vec::Vec,alloc::alloc::Global>,*mut enum2$ >) default_query_dispatcher.rs:451
rapier3d::geometry::narrow_phase::impl$2::compute_contacts::closure$0(*mut rapier3d::geometry::narrow_phase::impl$2::compute_contacts::closure_env$0,*mut rapier3d::data::graph::Edge) narrow_phase.rs:941
core::slice::iter::impl$190::for_each,rapier3d::geometry::narrow_phase::impl$2::compute_contacts::closure_env$0>(core::slice::iter::IterMut >,rapier3d::geometry::narrow_phase::impl$2::compute_contacts::closure_env$0) macros.rs:254
rapier3d::geometry::narrow_phase::NarrowPhase::compute_contacts(f32,f32,*mut rapier3d::dynamics::rigid_body_set::RigidBodySet,*mut rapier3d::geometry::collider_set::ColliderSet,*mut rapier3d::dynamics::joint::impulse_joint::impulse_joint_set::ImpulseJointSet,*mut rapier3d::dynamics::joint::multibody_joint::multibody_joint_set::MultibodyJointSet,ref$ >,ref$ >,ref$ >) narrow_phase.rs:807
rapier3d::pipeline::physics_pipeline::PhysicsPipeline::detect_collisions(*mut rapier3d::dynamics::integration_parameters::IntegrationParameters,*mut rapier3d::dynamics::island_manager::IslandManager,ref_mut$ >,*mut rapier3d::geometry::narrow_phase::NarrowPhase,*mut rapier3d::dynamics::rigid_body_set::RigidBodySet,*mut rapier3d::geometry::collider_set::ColliderSet,*mut rapier3d::dynamics::joint::impulse_joint::impulse_joint_set::ImpulseJointSet,*mut rapier3d::dynamics::joint::multibody_joint::multibody_joint_set::MultibodyJointSet,ref$ >,ref$ >,ref$ >,ref$ >,bool) physics_pipeline.rs:145
rapier3d::pipeline::physics_pipeline::PhysicsPipeline::step(*mut nalgebra::base::matrix::Matrix,nalgebra::base::dimension::Const<1>,nalgebra::base::array_storage::ArrayStorage >,*mut rapier3d::dynamics::integration_parameters::IntegrationParameters,*mut rapier3d::dynamics::island_manager::IslandManager,ref_mut$ >,*mut rapier3d::geometry::narrow_phase::NarrowPhase,*mut rapier3d::dynamics::rigid_body_set::RigidBodySet,*mut rapier3d::geometry::collider_set::ColliderSet,*mut rapier3d::dynamics::joint::impulse_joint::impulse_joint_set::ImpulseJointSet,*mut rapier3d::dynamics::joint::multibody_joint::multibody_joint_set::MultibodyJointSet,*mut rapier3d::dynamics::ccd::ccd_solver::CCDSolver,enum2$ > >,ref$ >,ref$ >) physics_pipeline.rs:478
```

In this `contact_manifold_convex_convex` function, we are handling different types of shapes. It has this default handler:
```rust
if let (Some(pfm1), Some(pfm2)) = (
shape1.as_polygonal_feature_map(),
shape2.as_polygonal_feature_map(),
) {
contact_manifold_pfm_pfm(
pos12, pfm1.0, pfm1.1, normal_constraints1, pfm2.0, pfm2.1, normal_constraints2, prediction, manifold,
)
} else {
return Err(Unsupported);
}
```

I'm reading it as: rapier only supports custom shapes that have polygonal features. I.e. it's impossible today to even implement an existing heightmap as a custom shape. Is my reading correct? Are there any plans to support true custom shapes? I'm not asking for crazy things, just at least to have an ability to implement any of the existing shapes myself, if needed.

This is a bit of a blocker for me currently in https://github.com/kvark/vandals-and-heroes/pull/3.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.