phaser - v4.0.0-rc.4
    Preparing search index...

    Allows accessing the mass, density, and center of mass of a Matter-enabled Game Object. Should be used as a mixin and not directly.

    interface Mass {
        centerOfMass: Math.Vector2;
        setDensity(value: number): this;
        setMass(value: number): this;
    }

    Implemented by

    Index

    Properties

    Methods

    Properties

    centerOfMass: Math.Vector2

    The body's center of mass.

    Calling this creates a new `Vector2 each time to avoid mutation.

    If you only need to read the value and won't change it, you can get it from GameObject.body.centerOfMass.

    Methods

    • Sets density of the body.

      Parameters

      • value: number

        The new density of the body.

      Returns this

    • Sets the mass of the Game Object's Matter Body.

      Parameters

      • value: number

        The new mass of the body.

      Returns this