Contents

octahedron(height:in:restitution:)

Creates a regular octahedron, a shape with 8 triangular faces, that the player tosses during gameplay.

Declaration

static func octahedron(height: Float, in unit: UnitLength = .meters, restitution: Float? = nil) -> TossableRepresentation

Parameters

  • height:

    The height of the octahedron.

  • unit:

    The unit of measurement for the height.

  • restitution:

    The coefficient of restitution, in the range [0, 1].

Discussion

The vertices for the simulated octahedron are oriented with one face toward +y with one vertex of that top face oriented toward -z. In this orientation, the height (h) is measured from face to opposing face, and the vertices have the following coordinates, which all lie on a circumscribed sphere of radius r = h/2 ⋅ sqrt(3): ±Y face: ±{ 0, +1, -sqrt(2) } ⋅ h/2, ±{ -sqrt(6)/2, +1, +sqrt(2)/2 } ⋅ h/2, ±{ +sqrt(6)/2, +1, +sqrt(2)/2 } ⋅ h/2

Higher restitution values indicate materials that conserve kinetic energy during collisions, causing objects to bounce off each other elastically. Lower values suggest materials that absorb kinetic energy, resulting in less bounce and more energy loss upon impact.

See Also

Creating geometric shapes