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

    Methods for setting the friction of an Arcade Physics Body.

    In Arcade Physics, friction is a special case of motion transfer from an "immovable" body to a riding body.

    interface Friction {
        setFriction(x: number, y?: number): this;
        setFrictionX(x: number): this;
        setFrictionY(y: number): this;
    }

    Implemented by

    Index

    Methods

    • Sets the friction of this game object's physics body. In Arcade Physics, friction is a special case of motion transfer from an "immovable" body to a riding body.

      Parameters

      • x: number

        The amount of horizontal friction to apply, [0, 1].

      • Optionaly: number

        The amount of vertical friction to apply, [0, 1]. Default x.

      Returns this

    • Sets the horizontal friction of this game object's physics body. This can move a riding body horizontally when it collides with this one on the vertical axis.

      Parameters

      • x: number

        The amount of friction to apply, [0, 1].

      Returns this

    • Sets the vertical friction of this game object's physics body. This can move a riding body vertically when it collides with this one on the horizontal axis.

      Parameters

      • y: number

        The amount of friction to apply, [0, 1].

      Returns this