Skip to content

Phaser.Physics.Matter.Components.Force ​

Phaser v4.1.0 · 英文原文

Scope: static

源码:src/physics/matter-js/components/Force.js#L9
引入版本:3.0.0

静态函数 ​

applyForce ​

<instance> applyForce(force) ​

说明:

将力量应用到一个物理体 处于目前的质量中心位置。

参数:

名称类型可选说明
forcePhaser.Math.Vector2否指定要施用的力量的矢量。

返回值: Phaser.Physics.Matter.Components.Force - 此游戏对象实例 。

源码:src/physics/matter-js/components/Force.js#L23
引入版本:3.0.0


applyForceFrom ​

<instance> applyForceFrom(position, force) ​

说明:

从特定位置对物理体施加力量.

参数:

名称类型可选说明
positionPhaser.Math.Vector2否部队的来历
forcePhaser.Math.Vector2否指定要施用的力量的矢量。

返回值: Phaser.Physics.Matter.Components.Force - 此游戏对象实例 。

源码:src/physics/matter-js/components/Force.js#L42
引入版本:3.0.0


thrust ​

<instance> thrust(speed) ​

说明:

向物理体的前进方向应用推力.

视质量和要求的速度,使用极小的值,如0.1.

参数:

名称类型可选说明
speednumber否用于方向力的速度值 。

返回值: Phaser.Physics.Matter.Components.Force - 此游戏对象实例 。

源码:src/physics/matter-js/components/Force.js#L60
引入版本:3.0.0


thrustBack ​

<instance> thrustBack(speed) ​

说明:

将推力应用到物理体的反方向.

视质量和要求的速度,使用极小的值,如0.1.

参数:

名称类型可选说明
speednumber否用于方向力的速度值 。

返回值: Phaser.Physics.Matter.Components.Force - 此游戏对象实例 。

源码:src/physics/matter-js/components/Force.js#L129
引入版本:3.0.0


thrustLeft ​

<instance> thrustLeft(speed) ​

说明:

将推力应用到物理体的左方向.

视质量和要求的速度,使用极小的值,如0.1.

参数:

名称类型可选说明
speednumber否用于方向力的速度值 。

返回值: Phaser.Physics.Matter.Components.Force - 此游戏对象实例 。

源码:src/physics/matter-js/components/Force.js#L83
引入版本:3.0.0


thrustRight ​

<instance> thrustRight(speed) ​

说明:

应用推力向物理体的正确方向.

视质量和要求的速度,使用极小的值,如0.1.

参数:

名称类型可选说明
speednumber否用于方向力的速度值 。

返回值: Phaser.Physics.Matter.Components.Force - 此游戏对象实例 。

源码:src/physics/matter-js/components/Force.js#L106
引入版本:3.0.0



社区翻译