用于 2D 精灵的刚体物理组件。
        Rigidbody2D 类提供与 Rigidbody 类基本相同的功能,两者的区别在于:Rigidbody2D 用于 2D 环境,Rigidbody 用于 3D 环境。向精灵添加 Rigidbody2D 组件后,其运动将受到物理引擎的控制。这意味着精灵将受到重力的影响,并且可以在脚本中使用力对其进行控制。通过添加适当的碰撞体组件,精灵还能响应与其他精灵的碰撞。这种行为完全来自 Unity 的物理系统;您只需提供极少量的代码,就能实现令人印象深刻和逼真的物理行为,并提供没有显式编码到游戏中的“自发的”游戏玩法。
另请参阅:Rigidbody 类、SpriteRenderer 类、Collider2D 类、Joint2D 类。
      
| angularDrag | 角阻力系数。 | 
| angularVelocity | 角速度(以度/秒为单位)。 | 
| attachedColliderCount | 返回附加到该 Rigidbody2D 的 Collider2D 的数量。 | 
| bodyType | Rigidbody2D 的物理行为类型。 | 
| centerOfMass | 刚体在本地空间中的质心。 | 
| collisionDetectionMode | 物理引擎用于检查两个对象是否发生碰撞的方法。 | 
| constraints | 控制该 Rigidbody2D 的模拟自由度。 | 
| drag | 阻力系数。 | 
| excludeLayers | The additional Layers that all Collider2D attached to this Rigidbody2D should exclude when deciding if a contact with another Collider2D should happen or not. | 
| freezeRotation | 控制物理是否会更改对象的旋转。 | 
| gravityScale | 该对象受重力影响的程度。 | 
| includeLayers | The additional Layers that all Collider2D attached to this Rigidbody2D should include when deciding if a contact with another Collider2D should happen or not. | 
| inertia | The Rigidbody's resistance to changes in angular velocity (rotation). | 
| interpolation | 在更新之间使用的物理插值。 | 
| isKinematic | 该刚体是否应该脱离物理控制? | 
| mass | 刚体的质量。 | 
| position | 刚体的位置。 | 
| rotation | 刚体的旋转。 | 
| sharedMaterial | 应用于附加到该 Rigidbody2D 的所有 Collider2D 的 PhysicsMaterial2D。 | 
| simulated | 指示物理系统是否应模拟刚体。 | 
| sleepMode | 刚体最初处于的睡眠状态。 | 
| totalForce | The total amount of force that has been explicitly applied to this Rigidbody2D since the last physics simulation step. | 
| totalTorque | The total amount of torque that has been explicitly applied to this Rigidbody2D since the last physics simulation step. | 
| useAutoMass | 是否应根据附加碰撞体的 [[Collider2D.density]] 自动计算总刚体 mass? | 
| useFullKinematicContacts | 是否允许运动/运动和运动/静态碰撞? | 
| velocity | 刚体的线性速度,采用单位/秒形式。 | 
| worldCenterOfMass | 获取刚体在全局空间中的质心。 | 
| AddForce | 对刚体施加力。 | 
| AddForceAtPosition | 在空间中的给定位置施加力。 | 
| AddRelativeForce | 向 rigidbody2D 添加力(相对于其坐标系)。 | 
| AddTorque | 在刚体的质心处施加扭矩。 | 
| Cast | 附加到 Rigidbody2D 的所有 Collider2D 形状都将投射到场景中 - 从每个碰撞体的位置开始,忽略附加到同一个 Rigidbody2D 的碰撞体。 | 
| ClosestPoint | 返回附加到此刚体的所有已启用碰撞体周边上最接近指定 position 的点。 | 
| Distance | 计算 collider 到附加到该 Rigidbody2D 的所有 Collider2D 的最小距离。 | 
| GetAttachedColliders | 返回附加到该 Rigidbody2D 的所有 Collider2D。 | 
| GetContacts | 获取附加到该刚体的所有碰撞体的所有接触点。 | 
| GetPoint | 根据位于刚体全局空间中的点 /point/,获取本地空间点。 | 
| GetPointVelocity | 点 /Point/(全局空间)处刚体的速度。 | 
| GetRelativePoint | 根据位于刚体本地空间中的点 /relativePoint/,获取全局空间点。 | 
| GetRelativePointVelocity | 点 /Point/(本地空间)处刚体的速度。 | 
| GetRelativeVector | 根据位于刚体本地空间中的向量 /relativeVector/,获取全局空间向量。 | 
| GetShapes | Gets all the PhysicsShape2D used by all Collider2D attached to the Rigidbody2D. | 
| GetVector | 根据位于刚体全局空间中的向量 /vector/,获取本地空间向量。 | 
| IsAwake | 刚体是否处于“唤醒”状态? | 
| IsSleeping | 刚体是否处于“睡眠”状态? | 
| IsTouching | 检查 collider 是否正在接触附加到该刚体的任何碰撞体。 | 
| IsTouchingLayers | 检查附加到该刚体的任何碰撞体是否正在接触指定 layerMask 上的任何碰撞体。 | 
| MovePosition | 将刚体移动到 /position/。 | 
| MoveRotation | 将刚体旋转到 /angle/(以度为单位)。 | 
| OverlapCollider | 获取与附加到该 Rigidbody2D 的所有碰撞体重叠的所有碰撞体的列表。 | 
| OverlapPoint | 检查是否有任何 Rigidbody2D 碰撞体与空间中的某个点重叠。 | 
| SetRotation | 将 Rigidbody2D 的旋转设置为 /angle/(以度为单位)。 | 
| Sleep | 使刚体进入“睡眠”状态。 | 
| WakeUp | 禁用刚体的“睡眠”状态。 | 
| gameObject | 此组件附加到的游戏对象。始终将组件附加到游戏对象。 | 
| tag | 此游戏对象的标签。 | 
| transform | 附加到此 GameObject 的 Transform。 | 
| hideFlags | 该对象应该隐藏、随场景一起保存还是由用户修改? | 
| name | 对象的名称。 | 
| BroadcastMessage | 调用此游戏对象或其任何子项中的每个 MonoBehaviour 上名为 methodName 的方法。 | 
| CompareTag | Checks the GameObject's tag against the defined tag. | 
| GetComponent | Gets a reference to a component of type T on the same GameObject as the component specified. | 
| GetComponentInChildren | Gets a reference to a component of type T on the same GameObject as the component specified, or any child of the GameObject. | 
| GetComponentInParent | Gets a reference to a component of type T on the same GameObject as the component specified, or any parent of the GameObject. | 
| GetComponents | Gets references to all components of type T on the same GameObject as the component specified. | 
| GetComponentsInChildren | Gets references to all components of type T on the same GameObject as the component specified, and any child of the GameObject. | 
| GetComponentsInParent | Gets references to all components of type T on the same GameObject as the component specified, and any parent of the GameObject. | 
| SendMessage | 调用此游戏对象中的每个 MonoBehaviour 上名为 methodName 的方法。 | 
| SendMessageUpwards | 调用此游戏对象中的每个 MonoBehaviour 上或此行为的每个父级上名为 methodName 的方法。 | 
| TryGetComponent | 获取指定类型的组件(如果存在)。 | 
| GetInstanceID | Gets the instance ID of the object. | 
| ToString | 返回对象的名称。 | 
| Destroy | 移除 GameObject、组件或资源。 | 
| DestroyImmediate | 立即销毁对象 /obj/。强烈建议您改用 Destroy。 | 
| DontDestroyOnLoad | 在加载新的 Scene 时,请勿销毁 Object。 | 
| FindAnyObjectByType | Retrieves any active loaded object of Type type. | 
| FindFirstObjectByType | Retrieves the first active loaded object of Type type. | 
| FindObjectOfType | 返回第一个类型为 type 的已加载的激活对象。 | 
| FindObjectsByType | Retrieves a list of all loaded objects of Type type. | 
| FindObjectsOfType | Gets a list of all loaded objects of Type type. | 
| Instantiate | 克隆 original 对象并返回克隆对象。 | 
| bool | 该对象是否存在? | 
| operator != | 比较两个对象是否引用不同的对象。 | 
| operator == | 比较两个对象引用,判断它们是否引用同一个对象。 |