Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Plane

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)

Hierarchy

Index

Constructors

constructor

Properties

body

body: null | Body

The body to which the shape is added to.

boundingSphereRadius

boundingSphereRadius: number

The local bounding sphere radius of this shape.

collisionResponse

collisionResponse: boolean

Whether to produce contact forces when in contact with other bodies. Note that contacts will be generated, but they will be disabled.

default

true

id

id: number

Identifier of the Shape.

material

material: null | Material

Optional material of the shape that regulates contact properties.

type

type: 0 | ShapeType

The type of this shape. Must be set to an int > 0 by subclasses.

worldNormal

worldNormal: Vec3

worldNormal

worldNormalNeedsUpdate

worldNormalNeedsUpdate: boolean

worldNormalNeedsUpdate

Static types

types: { BOX: 4; COMPOUND: 8; CONVEXPOLYHEDRON: 16; CYLINDER: 128; HEIGHTFIELD: 32; PARTICLE: 64; PLANE: 2; SPHERE: 1; TRIMESH: 256 } = SHAPE_TYPES

All the Shape types.

Type declaration

  • BOX: 4
  • COMPOUND: 8
  • CONVEXPOLYHEDRON: 16
  • CYLINDER: 128
  • HEIGHTFIELD: 32
  • PARTICLE: 64
  • PLANE: 2
  • SPHERE: 1
  • TRIMESH: 256

Methods

calculateLocalInertia

  • calculateLocalInertia(mass: number, target?: Vec3): Vec3

computeWorldNormal

updateBoundingSphereRadius

  • updateBoundingSphereRadius(): void

volume

  • volume(): number