-
-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MassProperties for 3D triangle mesh #16
Comments
Hi! Sorry for the late answer. Yes, the main missing component is the I don't have any references to give you on this. What we need here is to be able to compute the triangle mesh's volume and angular inertia tensor. Once you have these:
|
No worries, thanks for the details @sebcrozet. My ultimate goal is to turn an arbitrary glTF into a dynamic collider, and I figured implementing a collider for trimesh was the correct path. Can you explain a little more on how game engines don't allow dynamic triangle-meshes? How do they simulate collisions on arbitrary 3D models (eg Source engine)? Is there some way of translating models into a group of non-triangular primitive shapes that you link together? |
For arbitrary non-deformable 3D models, game physics engines generally require the model to be represented as a set of convex polyhedrons. So the solution is generally to compute a (often approximate) convex decomposition of the mesh with an algorithm like V-HACD, and use these convex parts as the collider shapes. ncollide has an implementation of HACD (which is a bit older than V-HACD) but it is not extremely robust. Now even if we had a working V-HACD implementation, you could not achieve your goal with the current version of Rapier because it does not support arbitrary 3D convex polyhedron yet. Though my current works on capsule shapes will make it much easier to support 3D convex polyhedron too. So I guess two things are possibles (and both are things we would like to support at some point):
|
Ok, that makes sense. I would be happy to try my hand at a V-HACD implementation. I'll try to keep an eye on the changelog, but if you can ping this thread once support for 3D convex polyhedron lands on master, then I will get started then. |
This is can be closed now that there is V-HACD in parry2d and rapier right? |
Computing mass-properties of a 3D triangle mesh has been added to Rapier 0.12 (non-alpha version). |
I'd like to have a 3D physics simulation using dynamic triangle meshes. I think (not sure?) that the main missing component in rapier is that
MassProperties
has not been implemented forTrimesh
, shown here: https://github.com/dimforge/rapier/blob/master/src/geometry/collider.rs#L202I'd be happy to take a stab at implementing this feature, but I don't understand the engine design or the involved math well enough (e.g. what is principal inertia, how to compute it, so on). If anyone has a good reference, I can take a look.
The text was updated successfully, but these errors were encountered: