オブジェクトの位置、回転、スケールを扱うクラス
シーン内のすべてのオブジェクトはTransformを持ちます。 Transformはオブジェクトの位置、回転、スケールを格納し、操作するために使用されます。 全てのTransformは親を持ち、階層的に位置、回転、スケールを適用することが出来ます。これはヒエラルキーウィンドウで回想を見ることが出来ます。 また、以下のようにループを使って子のTransformを使用する列挙体をサポートしています:
// Moves all transform children 10 units upwards! for (var child : Transform in transform) { child.position += Vector3.up * 10.0; }
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Example() { foreach (Transform child in transform) { child.position += Vector3.up * 10.0F; } } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def Example() as void: for child as Transform in transform: child.position += (Vector3.up * 10.0F)
See Also: Transformコンポーネント, Physics クラス.
| childCount | Transformの持つ子の数 |
| eulerAngles | オイラー角としての角度 |
| forward | ワールド空間のTransformの青軸 |
| hasChanged | フラグが最後に 'false' に設定された時からTransformに何らかの変更があったかどうか |
| localEulerAngles | 親のTransformオブジェクトから見た相対的なオイラー角としての回転値 |
| localPosition | 親のTransformオブジェクトから見た相対的な位置 |
| localRotation | 親のTransformオブジェクトから見た相対的な回転値 |
| localScale | 親のTransformオブジェクトから見た相対的なスケール |
| localToWorldMatrix | ローカル座標のポイントからワールド座標に変換した、行列の値 (Read Only) |
| lossyScale | オブジェクトのグローバルスケール (Read Only) |
| parent | Transformの親 |
| position | ワールド空間のTransformの位置 |
| right | ワールド空間のTransformの赤軸 |
| root | 階層の一番上のTransform |
| rotation | Quaternionとして保存されるワールド空間でのTransformの回転 |
| up | ワールド空間のTransformの緑軸 |
| worldToLocalMatrix | ワールド座標のポイントからローカル座標に変換した、行列の値 (Read Only) |
| DetachChildren | 全ての子オブジェクトを親オブジェクトから切り離します |
| Find | 子の名前で検索をし、取得します |
| GetChild | インデックスから子のtransformを取得します |
| GetSiblingIndex | 兄弟関係のインデックスを取得します |
| InverseTransformDirection | ワールド空間からローカル空間へ direction を変換します。Transform.TransformDirectionとは逆の機能になります |
| InverseTransformPoint | ワールド空間からローカル空間へ position を変換します。Transform.TransformPointとは逆の機能になります |
| InverseTransformVector | ワールド空間からローカル空間へ vector を変換します。Transform.TransformVectorとは逆の機能になります |
| IsChildOf | 親( parent )の子かどうか |
| LookAt | 対象のTransformを設定し、その方向へと向かせます |
| Rotate | Z軸で /eulerAngles.z/ 度回転、X軸で /eulerAngles.x/ 度回転、Y軸で /eulerAngles.y/ 度回転します (順番は説明した順) |
| RotateAround | ワールド座標の point を中心とした軸( axis )で angle 度回転させます |
| SetAsFirstSibling | Move the transform to the start of the local transfrom list. |
| SetAsLastSibling | Move the transform to the end of the local transfrom list. |
| SetParent | Transformの親を設定します |
| SetSiblingIndex | 兄弟インデックスを設定します |
| TransformDirection | ローカル空間からワールド空間へ direction を変換します |
| TransformPoint | ローカル空間からワールド空間へ position を変換します。 |
| TransformVector | ローカル空間からワールド空間へ vector を変換します。 |
| Translate | /translation/ の方向と距離に移動します |
| animation | GameObjectにアタッチされたAnimation (アタッチされていない場合はnull) |
| audio | GameObjectにアタッチされたAudioSource (アタッチされていない場合はnull) |
| camera | GameObjectにアタッチされたCamera (アタッチされていない場合はnull) |
| collider | GameObjectにアタッチされたCollider (アタッチされていない場合はnull) |
| collider2D | GameObjectにアタッチされたCollider2D |
| constantForce | GameObjectにアタッチされたConstantForce (アタッチされていない場合はnull) |
| gameObject | このコンポーネントはゲームオブジェクトにアタッチされます。コンポーネントはいつもゲームオブジェクトにアタッチされています。 |
| guiText | GameObjectにアタッチされたGUIText (アタッチされていない場合はnull) |
| guiTexture | GameObjectにアタッチされたGUITexture (アタッチされていない場合はnull) |
| hingeJoint | GameObjectにアタッチされたHingeJoint (アタッチされていない場合はnull) |
| light | GameObjectにアタッチされたLight (アタッチされていない場合はnull) |
| networkView | GameObjectにアタッチされたNetworkView (アタッチされていない場合はnull) |
| particleEmitter | GameObjectにアタッチされたParticleEmitter (アタッチされていない場合はnull) |
| particleSystem | GameObjectにアタッチされたParticleSystem (アタッチされていない場合はnull) |
| renderer | GameObjectにアタッチされたRenderer (アタッチされていない場合はnull) |
| rigidbody | GameObjectにアタッチされたRigidbody (アタッチされていない場合はnull) |
| rigidbody2D | GameObjectにアタッチされたRigidbody2D |
| tag | ゲームオブジェクトのタグ |
| transform | GameObjectにアタッチされたTransform (アタッチされていない場合はnull) |
| hideFlags | オブジェクトは非表示、シーンに保存、ユーザーが編集可能などを行うかどうか |
| name | オブジェクト名 |
| BroadcastMessage | ゲームオブジェクトまたは子オブジェクトにある すべての MonoBehaviour を継承したクラスにある methodName 名のメソッドを呼び出します。 |
| CompareTag | Is this game object tagged with /tag/? |
| GetComponent | Returns the component of Type type if the game object has one attached, null if it doesn't. |
| GetComponentInChildren | Returns the component of Type type in the GameObject or any of its children using depth first search. |
| GetComponentInParent | Returns the component of Type type in the GameObject or any of its parents. |
| GetComponents | Returns all components of Type type in the GameObject. |
| GetComponentsInChildren | Returns all components of Type type in the GameObject or any of its children. |
| GetComponentsInParent | Returns all components of Type type in the GameObject or any of its parents. |
| SendMessage | Calls the method named methodName on every MonoBehaviour in this game object. |
| SendMessageUpwards | Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour. |
| GetInstanceID | Returns the instance id of the object. |
| ToString | ゲームオブジェクトの名前を返します |
| Destroy | ゲームオブジェクト、コンポーネントやアセットを削除します |
| DestroyImmediate | 直ちにオブジェクトを破壊する。ですが、Destroy関数の方を使うことを推奨します |
| DontDestroyOnLoad | 新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します |
| FindObjectOfType | タイプから最初に見つけたアクティブのオブジェクトを返します |
| FindObjectsOfType | タイプから見つけた全てのアクティブのオブジェクト配列を返します |
| Instantiate | original のオブジェクトをクローンします |
| bool | オブジェクトが存在するかどうか |
| operator != | 二つのオブジェクトが異なるオブジェクトを参照しているか比較します |
| operator == | 二つのオブジェクトが同じオブジェクトを参照しているか比較します |