Class Shape

Base class for shapes

Hierarchy (view full)

Constructors

  • Parameters

    • Optional options: {
          collisionFilterGroup?: number;
          collisionFilterMask?: number;
          collisionResponse?: boolean;
          material?: Material;
          type?: ShapeType;
      }
      • Optional collisionFilterGroup?: number

        Default

        1
        
      • Optional collisionFilterMask?: number

        Default

        -1
        
      • Optional collisionResponse?: boolean

        Whether to produce contact forces when in contact with other bodies.

        Default

        true
        
      • Optional material?: Material

        Optional material of the shape that regulates contact properties.

        Default

        null
        

        Todo

        check this, the material is passed to the body, right?

      • Optional type?: ShapeType

        The type of this shape.

    Returns Shape

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

  • Parameters

    Returns void

    Todo

    use abstract for these kind of methods

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

    Returns void

  • Get the volume of this shape

    Returns number