外观
Phaser.Physics.Matter.Components.Velocity
Phaser v4.1.0 · 英文原文
Scope: static
源码:src/physics/matter-js/components/Velocity.js#L9
引入版本:3.0.0
静态函数
getAngularSpeed
<instance> getAngularSpeed()
说明:
获得当前物理体的旋转速度。 等同于其角速度的大小。
返回值: number - 物理体目前的角速度.
源码:src/physics/matter-js/components/Velocity.js#L137
引入版本:3.60.0
getAngularVelocity
<instance> getAngularVelocity()
说明:
获得当前物理体的旋转速度。
返回值: number - 物理体目前的角速度.
源码:src/physics/matter-js/components/Velocity.js#L106
引入版本:3.60.0
getVelocity
<instance> getVelocity()
说明:
获得物理体的当前线性速度。
返回值: Phaser.Types.Math.Vector2Like - 物理体目前的线性速度.
源码:src/physics/matter-js/components/Velocity.js#L75
引入版本:3.60.0
setAngularSpeed
<instance> setAngularSpeed(speed)
说明:
设置当前物理体的旋转速度。方向得到维护。会影响物理体的角速度。
参数:
| 名称 | 类型 | 可选 | 说明 |
|---|---|---|---|
| speed | number | 否 | 角速(原变种). |
返回值: Phaser.Physics.Matter.Components.Velocity - 此游戏对象实例 。
源码:src/physics/matter-js/components/Velocity.js#L119
引入版本:3.60.0
setAngularVelocity
<instance> setAngularVelocity(velocity)
说明:
立即设定物理体的角速度。位置、角度、力等不变。
参数:
| 名称 | 类型 | 可选 | 说明 |
|---|---|---|---|
| velocity | number | 否 | 角速法门. |
返回值: Phaser.Physics.Matter.Components.Velocity - 此游戏对象实例 。
源码:src/physics/matter-js/components/Velocity.js#L88
引入版本:3.0.0
setVelocity
<instance> setVelocity(x, [y])
说明:
设置物理体的横向和纵向速度。
参数:
| 名称 | 类型 | 可选 | 默认值 | 说明 |
|---|---|---|---|---|
| x | number | 否 | 水平速度值。 | |
| y | number | 是 | "x" | 垂直速度值,可以是正的也可以是负的。如果不给定,它将会与x值相同。 |
返回值: Phaser.Physics.Matter.Components.Velocity - 此游戏对象实例 。
源码:src/physics/matter-js/components/Velocity.js#L55
引入版本:3.0.0
setVelocityX
<instance> setVelocityX(x)
说明:
设置物理体的横向速度。
参数:
| 名称 | 类型 | 可选 | 说明 |
|---|---|---|---|
| x | number | 否 | 水平速度值,以像素每秒为单位. |
返回值: Phaser.Physics.Matter.Components.Velocity - 此游戏对象实例 。
源码:src/physics/matter-js/components/Velocity.js#L17
引入版本:3.0.0
setVelocityY
<instance> setVelocityY(y)
说明:
设置物理体的垂直速度。
参数:
| 名称 | 类型 | 可选 | 说明 |
|---|---|---|---|
| y | number | 否 | 垂直速度值,以像素每秒计. |
返回值: Phaser.Physics.Matter.Components.Velocity - 此游戏对象实例 。
源码:src/physics/matter-js/components/Velocity.js#L36
引入版本:3.0.0