Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines how the attached entity behaves under physics simulation.

Hierarchy

Index

Constructors

constructor

  • new RigidBody2D(bodyType?: BodyType, freezeRotation?: boolean, friction?: number, restitution?: number, density?: number): RigidBody2D
  • Parameters

    • Optional bodyType: BodyType
    • Optional freezeRotation: boolean
    • Optional friction: number
    • Optional restitution: number
    • Optional density: number

    Returns RigidBody2D

Properties

bodyType

bodyType: BodyType

Type of this body (static/kinematic/dynamic).

density

density: number

Specifies the density of this body. The body's mass is computed using the formula: mass = density*volume.

freezeRotation

freezeRotation: boolean

If true, this body cannot rotate, and should always stay upright (rotation angle = 0).

friction

friction: number

Specifies the friction factor of this body, when it slides along another body. Setting friction to 0 creates a frictionless slide, setting it to 1 creates a strong friction. You can also use values larger than 1.

restitution

restitution: number

Specifies the bounciness factor of the object. A value of zero means that the object does not bounce when it collides with another object (for example, a steel bar). A factor of 1 represents a perfect bounce with no loss of energy (for example, a superball). You can use values larger than 1.

Static _isSharedComp

_isSharedComp: boolean

Static _size

_size: number

Static _view

_view: any

Static cid

cid: number

Static density

Static freezeRotation

freezeRotation: ComponentFieldDesc

Static friction

Static restitution

restitution: ComponentFieldDesc

Methods

Static _dtorFn

  • Parameters

    Returns void

Static _fromPtr

Static _tempHeapPtr

  • Parameters

    Returns number

Static _toPtr

  • Parameters

    Returns void

Generated using TypeDoc