w0rm/elm-physics

Support a convex polyhedron shape

w0rm opened this issue · 1 comments

w0rm commented

With the release of https://package.elm-lang.org/packages/w0rm/elm-obj-file/latest there is an easy way to load TriangularMesh from Blender. elm-physics currently only supports Block3d (which is internally defined as a convex polyhedron).

Collision algorithm is limited to convex shapes. There are several options to construct a convex polyhedron shape:

  1. As a convex hull from a list of Point3d
  2. A function that takes TriangularMesh of Point3d and returns a Maybe of Shape (Nothing if a shape isn’t convex)
  3. An unsafe function that takes TriangularMesh of Point3d and returns a Shape

While 1. and 2. are good because they make it impossible to create wrong shapes, they are computationally intensive.

Open question: what to do with the center of mass of a convex polyhedron. Shall it be calculated or provided by the user.

w0rm commented

Implemented in #97