terry-bit-io / elm-physics / Physics.Shape


type alias Shape =
Internal.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 Length.Meters Physics.Coordinates.BodyCoordinates -> Shape

sphere : Sphere3d Length.Meters Physics.Coordinates.BodyCoordinates -> Shape

cylinder : Basics.Int -> Cylinder3d Length.Meters Physics.Coordinates.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 Length.Meters Physics.Coordinates.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: