Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Shape

Base class for shapes

Hierarchy

Index

Constructors

constructor

  • Parameters

    • options: { collisionResponse?: boolean; material?: Material; type?: ShapeType } = {}
      • 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: 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): void

updateBoundingSphereRadius

  • updateBoundingSphereRadius(): void
  • Computes the bounding sphere radius. The result is stored in the property .boundingSphereRadius

    Returns void

volume

  • volume(): number