Rigidbody3D is a component that creates a rigidbody collider.

Rigidbody3D 类用于创建刚体碰撞器。

层级 (查看完整内容)

属性

Extra data of the node.

组件的额外数据。IDE内部使用。

_id: number

Unique identifier for the component.

组件的唯一标识。

_singleton: boolean

Whether the component is a singleton, meaning only one instance of this type of script can be added to the same node.

是否为单例,即同一个节点只能添加此类型的脚本一次。

owner: Sprite3D

Gets the owner Node to which the component belongs.

获取组件所属的 Node 节点。

runInEditor: boolean

Whether the script can run in the IDE environment.

是否可以在 IDE 环境中运行。

scriptPath: string

The path of the script file.

脚本文件的路径。

访问器

  • get angularDamping(): number
  • 返回 number

    The angular damping of the rigidbody. It simulates angular resistance and other environmental factors to make the object's rotation slow down gradually.

    刚体的角速度阻尼。控制刚体旋转运动的阻尼系数,使旋转逐渐减速,防止永久旋转。

  • set angularDamping(value): void
  • 参数

    • value: number

    返回 void

  • get angularVelocity(): Vector3
  • 返回 Vector3

    The angular velocity of the rigidbody. It is represented by a three-dimensional vector (x, y, z) that corresponds to the angular velocity components of the rigidbody around X, Y, and Z axes. This value not only represents the magnitude but also includes direction. The unit is radians per second.

    刚体的角速度。由一个三维向量(Vector3)表示,分别对应刚体围绕X、Y、Z 轴的旋转速率分量,该分量值既有大小又有方向。单位是弧度/秒

  • set angularVelocity(value): void
  • 参数

    返回 void

  • get frictionCombine(): PhysicsCombineMode
  • 返回 PhysicsCombineMode

    Friction combination mode, used to define how the friction coefficients of two objects are combined during a collision to determine the final friction force. The values include:

    • Average: The friction coefficients of the two objects are averaged.
    • Minimum: The minimum friction coefficient of the two objects is used.
    • Maximum: The maximum friction coefficient of the two objects is used.
    • Multiply: The friction coefficients of the two objects are multiplied to get the final friction coefficient.

    摩擦力组合模式,用于定义在两个物体发生碰撞时,如何组合它们的摩擦系数,以确定最终的摩擦力。 值包括:

    • Average(平均值):两个物体的摩擦系数取平均值。
    • Minimum(最小值):使用两个物体摩擦系数中的最小值。
    • Maximum(最大值):使用两个物体摩擦系数中的最大值。
    • Multiply(乘积):将两个物体的摩擦系数相乘,得到最终的摩擦系数。
  • set frictionCombine(value): void
  • 参数

    返回 void

  • get isKinematic(): boolean
  • 返回 boolean

    Determines if the rigidbody is kinematic. If true, the rigidbody can only be moved by transform property, not by other force-related properties.

    确定刚体是否为运动物体。如果为true仅可通过transform属性移动物体,而非其他力相关属性。

  • set isKinematic(value): void
  • 参数

    • value: boolean

    返回 void

  • get linearFactor(): Vector3
  • 返回 Vector3

    The linear motion scaling factor for each axis of the rigidbody. If the value of any axis is 0, it means that the linear motion is frozen on that axis. If the value is 1, it means that linear motion on that axis is not restricted.

    限制刚体在特定轴向的线性运动, 如果某一轴的值为0表示冻结在该轴的线性运动。为1表示在该轴的线性运动不受限制。

  • set linearFactor(value): void
  • 参数

    返回 void

  • get linearVelocity(): Vector3
  • 返回 Vector3

    The linear velocity of the rigidbody. It is represented by a three-dimensional vector (x, y, z) that corresponds to the linear velocity components of the rigidbody on the X, Y, and Z axes. This value not only represents the magnitude but also includes direction.

    刚体的线速度。由一个三维向量(x, y, z)表示,分别对应刚体在X、Y、Z 轴上的速度分量,该分量值既有大小又有方向。

  • set linearVelocity(value): void
  • 参数

    返回 void

  • get restitutionCombine(): PhysicsCombineMode
  • 返回 PhysicsCombineMode

    The restitution mode of the collider. The values include:

    • Average: The friction coefficients of the two objects are averaged.
    • Minimum: The minimum friction coefficient of the two objects is used.
    • Maximum: The maximum friction coefficient of the two objects is used.
    • Multiply: The friction coefficients of the two objects are multiplied to get the final friction coefficient.

    弹力组合模式,用于定义在两个物体发生碰撞时,如何组合它们的弹力系数,以确定最终的弹力。 值为:

    • Average(平均值):两个物体的摩擦系数取平均值。
    • Minimum(最小值):使用两个物体摩擦系数中的最小值。
    • Maximum(最大值):使用两个物体摩擦系数中的最大值。
    • Multiply(乘积):将两个物体的摩擦系数相乘,得到最终的摩擦系数。
  • set restitutionCombine(value): void
  • 参数

    返回 void

方法

  • 参数

    • fx: number

      x轴方向的力

    • fy: number

      y轴方向的力

    • fz: number

      z轴方向的力

    • localOffset: Vector3 = null

      受力点距离质点的偏移

    返回 void

    应用作用力

  • 参数

    • impulse: Vector3

      The impulse vector to apply.

    • localOffset: Vector3 = null

      The offset at which the impulse is applied, relative to the rigidbody's center of mass. If null, the impulse is applied at the center.

    返回 void

    Applies an impulse to the rigidbody.

    对刚体应用冲量。

  • 参数

    • torqueImpulse: Vector3

      The torque impulse vector to apply.

    返回 void

    Applies a torque impulse (rotational impulse) to the rigidbody.

    对刚体应用扭转冲量(旋转冲量)。

  • 返回 void

    Executed after the component is activated. At this point, all nodes and components have been created. This method is executed only once.

    组件被激活后执行,此时所有节点和组件均已创建完毕,此方法只执行一次。

  • 返回 void

    Resets the component's parameters to their default values. If this function is implemented, the component will be reset and automatically recycled for future use. If not reset, it will not be recycled for reuse.

    将组件的参数重置为默认值。如果实现了这个函数,组件将被重置并自动回收到对象池,方便下次复用。 如果没有重置,则不会进行回收复用。