Version: 2018.1

Rigidbody2D

class in UnityEngine

/

継承:Component

マニュアルに切り替える

説明

2D スプライトのための Rigidbody 物理挙動コンポーネント

The Rigidbody2D class essentially provides the same functionality in 2D that the Rigidbody class provides in 3D. Adding a Rigidbody2D component to a sprite puts it under the control of the physics engine. By itself, this means that the sprite will be affected by gravity and can be controlled from scripts using forces. By adding the appropriate collider component, the sprite will also respond to collisions with other sprites. This behaviour comes entirely from Unity's physics system; very little code is required to get impressive and authentic physical behaviour and allows for "emergent" gameplay that was not explicitly coded into the game.

関連項目: Rigidbody クラス、SpriteRenderer クラス、Collider2D クラス、Joint2D クラス

変数

angularDragAngular Drag の係数
angularVelocity角度 / 秒で示される角速度
attachedColliderCountReturns the number of Collider2D attached to this Rigidbody2D.
bodyType Rigidbody2D の物理的なビヘイビアのタイプ
centerOfMassローカル空間でのリジッドボディの質量の中心
collisionDetectionMode物理エンジンが2つのオブジェクトが衝突したかを確認する方式
constraintsこの Rigidbody2D のシミュレーションを実行できる自由度合いを管理します。
dragDrag 係数
freezeRotation物理演算による回転の影響を受けるかどうか
gravityScaleオブジェクトが重力により影響を受ける度合い
inertiaリジッドボディの回転慣性
interpolation物理挙動の Update の間で使用される補間
isKinematicRigidbody が物理挙動の影響を受けるか
massMass of the Rigidbody.
positionRigidbody の位置
rotationRigidbody の回転
sharedMaterial PhysicsMaterial2D は Rigidbody2D にアタッチされたすべての Collider2D に適用されています。
simulatedリジッドボディが物理システムによってシミュレーションするかを示します。
sleepModeリジッドボディが最初に設定されるスリープ状態
useAutoMassリジッドボディ全体の mass をアタッチされているコライダーの [[Collider2D.density]] から自動的に計算するか。
useFullKinematicContactskinematic/kinematic (キネマティック/キネマティック) と kinematic/static (キネマティック/静的) の衝突は可能か。
velocityリジッドボディの線形速度
worldCenterOfMassグローバル空間でのリジッドボディの質量の中心を取得します。

Public 関数

AddForceRigidbody に力を適用します
AddForceAtPosition空間上の指定地点で力を加えます
AddRelativeForce座標システムを基準にリジッドボディ 2D に力を加えます。
AddTorqueRigidbody の重心にトルクを適用します
Cast Rigidbody2D にアタッチされるすべての Collider2D の形状は、各コライダーの位置で開始して、同じ Rigidbody2D にアタッチされたコライダーを無視し、シーンにキャストされます。
DistanceCalculates the minimum distance of this collider against all Collider2D attached to this Rigidbody2D.
GetAttachedCollidersReturns all Collider2D that are attached to this Rigidbody2D.
GetContactsRetrieves all contact points for all of the collider(s) attached to this rigidbody.
GetPoint指定されたリジッドボディのグローバル空間での point からローカル空間ポイントを取得します。
GetPointVelocityグローバル空間におけるリジッドボディの Point での速度。
GetRelativePointリジッドボディのローカル空間において指定された relativePoint のグローバル空間ポイントを取得します。
GetRelativePointVelocityローカル空間における Point でのリジッドボディの速度。
GetRelativeVectorリジッドボディのローカル空間において指定した relativeVector のグローバル空間ベクトルを取得します。
GetVector指定されたリジッドボディグローバル空間 vector のローカル空間ベクトルを取得します。
IsAwakeRigidbody がスリープ状態にないことを判定します
IsSleepingRigidbody がスリープ態であるか判定します
IsTouchingChecks whether the collider is touching any of the collider(s) attached to this rigidbody or not.
IsTouchingLayersこのリジッドボディにアタッチされているコライダーのどれかが指定した layerMask のコライダーに触れているか確認します。
MovePositionRigidbody オブジェクトを指定する位置へ移動します
MoveRotationRigidbody オブジェクトを指定する角度(単位は度)へ回転します
OverlapColliderGet a list of all colliders that overlap all colliders attached to this Rigidbody2D.
OverlapPoint Rigidbody2D コライダーのいずれかが空間内の点と重複するかを確認します。
SleepRigidbody をスリープ状態にします
WakeUpRigidbody のスリープ状態を無効化します

継承メンバー

変数

gameObjectこのコンポーネントはゲームオブジェクトにアタッチされます。コンポーネントはいつもゲームオブジェクトにアタッチされています。
tagゲームオブジェクトのタグ
transformThe Transform attached to this GameObject.
hideFlagsオブジェクトは非表示、シーンに保存、ユーザーが編集可能、などを設定する。
nameオブジェクト名

Public 関数

BroadcastMessageゲームオブジェクトまたは子オブジェクトにあるすべての MonoBehaviour を継承したクラスにある methodName 名のメソッドを呼び出します。
CompareTagこのゲームオブジェクトは tag とタグ付けされているかどうか
GetComponentゲームオブジェクトに type がアタッチされている場合は type のタイプを使用してコンポーネントを返します。ない場合は null です
GetComponentInChildren GameObject や深さ優先探索を活用して、親子関係にある子オブジェクトから type のタイプのコンポーネントを取得します。
GetComponentInParent GameObject や深さ優先探索を活用して、親子関係にある親オブジェクトから type のタイプのコンポーネントを取得します。
GetComponents GameObject から type のタイプのコンポーネントを「すべて」取得します。
GetComponentsInChildren GameObject や深さ優先探索を活用して、親子関係にある子オブジェクトから type のタイプのコンポーネントを「すべて」取得します。
GetComponentsInParent GameObject や深さ優先探索を活用して、親子関係にある親オブジェクトから type のタイプのコンポーネントを「すべて」取得します。
SendMessageゲームオブジェクトにアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します
SendMessageUpwardsゲームオブジェクトと親(の親、さらに親 ... )にアタッチされているすべての MonoBehaviour にある methodName と名付けたメソッドを呼び出します
GetInstanceIDオブジェクトのインスタンス ID を返します
ToStringReturns the name of the GameObject.

Static 関数

Destroyゲームオブジェクトやコンポーネント、アセットを削除します
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoad新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します
FindObjectOfTypeタイプ type から最初に見つけたアクティブのオブジェクトを返します
FindObjectsOfTypeタイプから見つけたすべてのアクティブのオブジェクト配列を返します
Instantiateoriginal のオブジェクトをクローンします

Operator

boolオブジェクトが存在するかどうか
operator !=二つのオブジェクトが異なるオブジェクトを参照しているか比較します
operator ==2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。