物理演算によりオブジェクトの位置を制御します。
Adding a Rigidbody component to an object will put its motion under the control of Unity's physics engine. Even without adding any code, a Rigidbody object will be pulled downward by gravity and will react to collisions with incoming objects if the right Collider component is also present.
また、Rigidbody はオブジェクトに力を適用し、物理的に現実的な方法でそれをコントロールするためのスクリプト API も有しています。例えば、ある自動車の挙動は車輪によって加えられる力という面から指定することができます。この情報に基づけば、物理エンジンは車の挙動のその他ほとんどの側面を扱うことができるので、現実的に加速したり、衝突に対して正確に応答します。
スクリプトでは、FixedUpdate 関数は力を適用したり、Rigidbody の設定を変更する場所とすることが推奨されます(対照に Update は、その他ほとんどのフレーム更新作業で使用されます)。理由は、物理挙動の更新が時間進行単位で行われており、フレーム更新は関係ないからです。FixedUpdate は物理挙動更新の直前に呼び出されるため、その中でなされたどのような変更も直接反映されます。
Rigidbody で作業を始める際の一般的な問題には、ゲームの物理挙動が「スローモーション」で実行されているように見えるというものがあります。これは実際にあなたのモデルに使用されているスケールに起因しているものです。デフォルトの重力設定は、1 ワールドユニットが距離の 1 メートルに対応することを前提としています。非物理的なゲームでは、あなたのモデルがすべて 100 ユニットの長さであっても大した差はありませんが、物理挙動を用いればそれらはとても大きなオブジェクトとして扱われます。もし小さいと思われるようなオブジェクトに大きなスケールを使用すれば、それらはとてもゆっくりと落下しているように見えます。なぜなら、物理エンジンはそれらをとても長い距離を落下しているとても大きなオブジェクトと見なすからです。このことを念頭に置き、オブジェクトは現実の生活のスケールよりも大きく、または小さくするようにしましょう(したがって、例えば車は 4 ユニット = 4 メートルほどにしておくべきです)。
angularDrag | オブジェクトの Angular drag (回転抗力) |
angularVelocity | The angular velocity vector of the rigidbody measured in radians per second. |
automaticCenterOfMass | Whether or not to calculate the center of mass automatically. |
automaticInertiaTensor | Whether or not to calculate the inertia tensor automatically. |
centerOfMass | Transform の原点に対する質量の中心 |
collisionDetectionMode | Rigidbody の衝突検出モード |
constraints | Rigidbody のシミュレーションで自由に操作できる軸をコントロールします |
detectCollisions | 衝突検出を有効にするかどうか(デフォルトでは常に有効) |
drag | オブジェクトの Drag (抗力) |
excludeLayers | The additional layers that all Colliders attached to this Rigidbody should exclude when deciding if the Collider can come into contact with another Collider. |
freezeRotation | 物理演算による回転の影響を受けるかどうか |
includeLayers | The additional layers that all Colliders attached to this Rigidbody should include when deciding if the Collider can come into contact with another Collider. |
inertiaTensor | The inertia tensor of this body, defined as a diagonal matrix in a reference frame positioned at this body's center of mass and rotated by Rigidbody.inertiaTensorRotation. |
inertiaTensorRotation | 慣性テンソルの回転角度 |
interpolation | Interpolation provides a way to manage the appearance of jitter in the movement of your Rigidbody GameObjects at run time. |
isKinematic | 物理演算の影響を受けるかどうか |
mass | Rigidbody の質量 |
maxAngularVelocity | The maximum angular velocity of the rigidbody measured in radians per second. (Default 7) range { 0, infinity }. |
maxDepenetrationVelocity | 貫通状態から出るときのリジッドボディの最大速度 |
maxLinearVelocity | The maximum linear velocity of the rigidbody measured in meters per second. |
position | Rigidbody の位置 |
rotation | The rotation of the Rigidbody. |
sleepThreshold | オブジェクトがスリープ状態に入る、質量で正規化された運動エネルギーのしきい値。 |
solverIterations | solverIterations はリジッドボディのジョイントと衝突の接触がどれだけ正確に解決されるかに影響を与えます。Physics.defaultSolverVelocityIterations をオーバーライドします。正数でなければなりません。 |
solverVelocityIterations | solverVelocityIterations はリジッドボディのジョイントと衝突の接触がどれだけ正確に解決されるかに影響を与えます。Physics.defaultSolverVelocityIterations をオーバーライドします。正数でなければなりません。 |
useGravity | Rigidbody が重力の影響を受けるかどうか |
velocity | The velocity vector of the rigidbody. It represents the rate of change of Rigidbody position. |
worldCenterOfMass | ワールド座標による質量の中心値(読み取り専用) |
AddExplosionForce | 爆発のエフェクトをシミュレートするために Rigidbody に力を適用させます。 |
AddForce | Rigidbody に力を加えます |
AddForceAtPosition | 特定の位置から力を適用します。結果、これはトルクを適用しオブジェクトに力を加えます |
AddRelativeForce | ローカル座標に対して Rigidbody に相対的な力を加えます。 |
AddRelativeTorque | ローカル座標に対して Rigidbody に相対的な力を加えます。 |
AddTorque | Rigidbody にトルクを追加します |
ClosestPointOnBounds | アタッチされたコライダーのバウンディングボックスにもっとも近い位置 |
GetAccumulatedForce | Returns the force that the Rigidbody has accumulated before the simulation step. |
GetAccumulatedTorque | Returns the torque that the Rigidbody has accumulated before the simulation step. |
GetPointVelocity | ワールド座標における、Rigidbody オブジェクトの速度を取得します |
GetRelativePointVelocity | ローカル座標における、Rigidbody オブジェクトの相対的速度を取得します |
IsSleeping | スリープモードかどうか |
Move | Moves the Rigidbody to position and rotates the Rigidbody to rotation. |
MovePosition | Moves the kinematic Rigidbody towards position. |
MoveRotation | Rigidbody オブジェクトを指定する角度へ回転します |
ResetCenterOfMass | Rigidbody の重心をリセットします。 |
ResetInertiaTensor | 慣性テンソル値と回転をリセットします。 |
SetDensity | 不変な密度と仮定してアタッチされたコライダーをもとに質量を設定します |
Sleep | 最新の 1 フレームで Rigidbody を強制的にスリープモードにします |
SweepTest | Tests if a rigidbody would collide with anything, if it was moved through the Scene. |
SweepTestAll | Rigidbody.SweepTest のようですが、これはヒットしたすべてを返します |
WakeUp | 強制的にスリープモードを解除します |
OnCollisionEnter | この collider/rigidbody は他の collider/rigidbody に触れたときに OnCollisionEnter は呼び出されます。 |
OnCollisionExit | この collider/rigidbody が他の collider/rigidbody と触れ合うのをやめたときに OnCollisionExit は呼び出されます。 |
OnCollisionStay | OnCollisionStay is called once per frame for every Collider or Rigidbody that touches another Collider or Rigidbody. |
gameObject | このコンポーネントはゲームオブジェクトにアタッチされます。コンポーネントはいつもゲームオブジェクトにアタッチされています。 |
tag | ゲームオブジェクトのタグ |
transform | The Transform attached to this GameObject. |
hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
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 | Gets the component of the specified type, if it exists. |
GetInstanceID | Gets the instance ID of the object. |
ToString | Returns the name of the object. |
Destroy | Removes a GameObject, component or asset. |
DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
DontDestroyOnLoad | Do not destroy the target Object when loading a new Scene. |
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 == | 2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.