Class Particle2

Particle2 shape.

Example

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

Hierarchy (view full)

Constructors

Properties

body: Body

The body to which the shape is added to.

boundingSphereRadius: number

The local bounding sphere radius of this shape.

collisionFilterGroup: number

Default

1
collisionFilterMask: number

Default

-1
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: number

Identifier of the Shape.

material: Material

Optional material of the shape that regulates contact properties.

type: 0 | ShapeType

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

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

All the Shape types.

Type declaration

  • Readonly BOX: 4

    BOX

  • Readonly COMPOUND: 8

    COMPOUND

  • Readonly CONVEXPOLYHEDRON: 16

    CONVEXPOLYHEDRON

  • Readonly CYLINDER: 128

    CYLINDER

  • Readonly HEIGHTFIELD: 32

    HEIGHTFIELD

  • Readonly PARTICLE: 64

    PARTICLE

  • Readonly PLANE: 2

    PLANE

  • Readonly SPHERE: 1

    SPHERE

  • Readonly TRIMESH: 256

    TRIMESH

Methods

  • Computes the bounding sphere radius. The result is stored in the property .boundingSphereRadius

    Returns void

  • Get the volume of this shape

    Returns number