Heightfield shape class. Height data is given as an array. These data points are spread out evenly with a given distance.
@todo Should be possible to use along all axes, not just y
@todo should be possible to scale along all axes
@todo Refactor elementSize to elementSizeX and elementSizeY
Helper class for the World. Generates ContactEquations.
@todo Sphere-ConvexPolyhedron contacts
@todo Contact reduction
@todo should move methods to prototype
A plane, facing in the Z direction. The plane has its surface at z=0 and everything below z=0 is assumed to be solid plane. To make the plane face in some other direction than z, you must put it inside a Body and rotate that body. See the demos.
@example
const planeShape = new CANNON.Plane()
const planeBody = new CANNON.Body({ mass: 0, shape: planeShape })
planeBody.quaternion.setFromEuler(-Math.PI / 2, 0, 0) // make it face up
world.addBody(planeBody)
A Quaternion describes a rotation in 3D space. The Quaternion is mathematically defined as Q = xi + yj + z*k + w, where (i,j,k) are imaginary basis vectors. (x,y,z) can be seen as a vector related to the axis of rotation, while the real multiplier, w, is related to the amount of rotation.
@param x Multiplier of the imaginary basis vector i.
@param y Multiplier of the imaginary basis vector j.
@param z Multiplier of the imaginary basis vector k.
@param w Multiplier of the real part.
@see http://en.wikipedia.org/wiki/Quaternion
Trimesh.
@example
// How to make a mesh with a single triangle
final vertices =
0, 0, 0, // vertex 0
1, 0, 0, // vertex 1
0, 1, 0 // vertex 2
final indices =
0, 1, 2 // triangle 0
final trimeshShape = CANNON.Trimesh(vertices, indices)