Phaser API Documentation

  Version: 
Filter
Namespace: Transform
Phaser.Physics.Matter.Components.Transform

Members

angle: number
Focus
Focus

Description:

Use angle to set or get rotation of the physics body associated to this GameObject. Unlike rotation, when using set the value can be in degrees, which will be converted to radians internally.

Type:
number
Focus
Focus
rotation: number
Focus
Focus

Description:

Use rotation to set or get the rotation of the physics body associated with this GameObject. The value when set must be in radians.

Type:
number
Focus
Focus
scaleX: number
Focus
Focus

Description:

The horizontal scale of this Game Object.

Type:
number
Focus
Focus
scaleY: number
Focus
Focus

Description:

The vertical scale of this Game Object.

Type:
number
Focus
Focus
x: number
Focus
Focus

Description:

The x position of this Game Object.

Type:
number
Focus
Focus
y: number
Focus
Focus

Description:

The y position of this Game Object.

Type:
number
Focus
Focus

Methods

setPosition([x], [y])
Focus
Focus

Description:

Sets the position of the physics body along x and y axes. Both the parameters to this function are optional and if not passed any they default to 0. Velocity, angle, force etc. are unchanged.

Parameters:

name type arguments Default description
x number <optional> 0

The horizontal position of the body.

y number <optional> x

The vertical position of the body.

Returns:
Description:

This Game Object.

Focus
Focus
setRotation([radians])
Focus
Focus

Description:

Immediately sets the angle of the Body. Angular velocity, position, force etc. are unchanged.

Parameters:

name type arguments description
radians number <optional>

The angle of the body, in radians.

Returns:
Description:

This Game Object.

Focus
Focus
setFixedRotation()
Focus
Focus

Description:

Setting fixed rotation sets the Body inertia to Infinity, which stops it from being able to rotate when forces are applied to it.

Returns:
Description:

This Game Object.

Focus
Focus
setAngle([degrees])
Focus
Focus

Description:

Immediately sets the angle of the Body. Angular velocity, position, force etc. are unchanged.

Parameters:

name type arguments description
degrees number <optional>

The angle to set, in degrees.

Returns:
Description:

This Game Object.

Focus
Focus
setScale([x], [y], [point])
Focus
Focus

Description:

Sets the scale of this Game Object.

Parameters:

name type arguments Default description
x number <optional> 1

The horizontal scale of this Game Object.

y number <optional> x

The vertical scale of this Game Object. If not set it will use the x value.

point Phaser.Math.Vector2 <optional>

The point (Vector2) from which scaling will occur.

Returns:
Description:

This Game Object.

Focus
Focus