Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Particle

Particle shape.

example
const particleShape = new CANNON.Particle()
const particleBody = new CANNON.Body({ mass: 1, shape: particleShape })
world.addBody(particleBody)

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.

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

updateBoundingSphereRadius

  • updateBoundingSphereRadius(): void

volume

  • volume(): number