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

    Contains methods for changing the velocity of a Matter Body. Should be used as a mixin and not called directly.

    interface Velocity {
        getAngularSpeed(): number;
        getAngularVelocity(): number;
        getVelocity(): Vector2Like;
        setAngularSpeed(speed: number): this;
        setAngularVelocity(velocity: number): this;
        setVelocity(x: number, y?: number): this;
        setVelocityX(x: number): this;
        setVelocityY(y: number): this;
    }

    Implemented by

    Index

    Methods

    • Gets the current rotational speed of the body. Equivalent to the magnitude of its angular velocity.

      Returns number

    • Gets the current rotational velocity of the body.

      Returns number

    • Sets the current rotational speed of the body. Direction is maintained. Affects body angular velocity.

      Parameters

      • speed: number

        The angular speed.

      Returns this

    • Sets the angular velocity of the body instantly. Position, angle, force etc. are unchanged.

      Parameters

      • velocity: number

        The angular velocity.

      Returns this

    • Sets both the horizontal and vertical velocity of the physics body.

      Parameters

      • x: number

        The horizontal velocity value.

      • Optionaly: number

        The vertical velocity value, it can be either positive or negative. If not given, it will be the same as the x value. Default x.

      Returns this

    • Sets the horizontal velocity of the physics body.

      Parameters

      • x: number

        The horizontal velocity value.

      Returns this

    • Sets vertical velocity of the physics body.

      Parameters

      • y: number

        The vertical velocity value.

      Returns this