Giter VIP home page Giter VIP logo

Comments (6)

willcrichton avatar willcrichton commented on August 26, 2024 1

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.

from rapier.

sebcrozet avatar sebcrozet commented on August 26, 2024

Hi! Sorry for the late answer.

Yes, the main missing component is the MassProperties computation. Implementing this will allow meshes to be dynamic.
However, it should be kept in mind that most game physics engines don't allow dynamic triangle-meshes because they can quickly suffer from some collision-detection problems causing the to be stuck (mostly because triangles-meshes are generally considered to not have any interior).

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:

  • The TriMesh mass is equal to the volume multiplied by the collider's density.
  • The TriMesh principal inertia is obtained by the Eigendecomposition of the angular inertia tensor like this.

from rapier.

willcrichton avatar willcrichton commented on August 26, 2024

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?

from rapier.

sebcrozet avatar sebcrozet commented on August 26, 2024

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):

  • Find a way to compute the mass properties of triangle meshes.
  • Implement an algorithm like V-HACD, and wait for Rapier to support arbitrary 3D convex polyhedron shapes (should land in one or two months).

from rapier.

zicklag avatar zicklag commented on August 26, 2024

This is can be closed now that there is V-HACD in parry2d and rapier right?

from rapier.

sebcrozet avatar sebcrozet commented on August 26, 2024

Computing mass-properties of a 3D triangle mesh has been added to Rapier 0.12 (non-alpha version).

from rapier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.