Create a cylinder shape with the given number of side faces, clamped to at least 3. Even numbers are more efficient, because collision performance depends on the number of unique non-parallel faces and edges.
Create a capsule shape: a cylinder with hemispherical end caps.
The axis, center point, radius, and length are taken from the given Cylinder3d.
Subtract the first shape from the second. The subtracted shape must be fully contained within the other. It reduces volume, mass, and inertia, and is excluded from collision detection.
Useful for hollow bodies.
crate =
Shape.block outer
|> Shape.minus (Shape.block inner)Add a shape to another.
snowman =
Shape.sphere bottom
|> Shape.plus (Shape.sphere top)Combine a list of shapes.
dumbbell =
Shape.sum
[ Shape.cylinder 12 leftWeight
, Shape.cylinder 12 bar
, Shape.cylinder 12 rightWeight
]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:
Shapes are needed for creating compound dynamic and static bodies.
The supported primitive shapes are block, sphere, cylinder, and capsule. For complex geometry use unsafeConvex.
Shapes within a body should not overlap — composing shapes only affects physical properties like mass, inertia, and center of mass. Use plus and minus to combine shapes, for example to create hollow bodies.