w0rm/elm-physics/5.1.3

NOTE: the latest version is 6.2.0

Physics.Shape

type alias Shape =
Protected

Shapes are only needed for creating compound bodies.

If you need a body with a single shape, use the corresponding functions from the Physics.Body module.

The supported primitive shapes are:

For the more complex cases use the unsafeConvex shape.

Shapes are defined in the body coordinate system.

block : Block3d Meters BodyCoordinates -> Shape
sphere : Sphere3d Meters BodyCoordinates -> Shape
cylinder : Int -> Cylinder3d Meters BodyCoordinates -> Shape

Create a cylinder shape by specifying the number of subdivisions >= 3.

cylinder 12 myCylinder -- A cylinder with 12 faces (not counting the top and bottom face)


cylinder 2 myCylinder -- Too few faces so it has 3 faces instead

Note that it’s more efficient to simulate cylinders with an even number of faces than an odd number of faces. This is because the collision performance depends on the number of unique faces that are not parallel with each other (and edges too).

unsafeConvex : TriangularMesh (Point3d Meters BodyCoordinates) -> Shape

Create a shape from a triangular mesh. This is useful if you want to import from Blender using elm-obj-file.

Note: this may cause unexpected behavior, unless you make sure that: