Transform
Represents the position, rotation, and scale of a GameObject in 3D space. Nearly every VRChat interaction involves reading or modifying a Transform to move objects, orient players, or build dynamic world elements.
Properties
| Property | Type | Access |
|---|---|---|
| childCount | int | get |
| eulerAngles | Vector3 | get, set |
| forward | Vector3 | get, set |
| gameObject | GameObject | get |
| hasChanged | bool | get, set |
| hierarchyCapacity | int | get, set |
| hierarchyCount | int | get |
| localEulerAngles | Vector3 | get, set |
| localPosition | Vector3 | get, set |
| localRotation | Quaternion | get, set |
| localScale | Vector3 | get, set |
| localToWorldMatrix | UnityEngineMatrix4x4 | get |
| lossyScale | Vector3 | get |
| name | string | get, set |
| parent | Transform | get, set |
| position | Vector3 | get, set |
| right | Vector3 | get, set |
| root | Transform | get |
| rotation | Quaternion | get, set |
| transform | Transform | get |
| up | Vector3 | get, set |
| worldToLocalMatrix | UnityEngineMatrix4x4 | get |
forward
The blue axis (Z+) direction of the object in world space.
let dir: Vector3 = transform.forwardlocalPosition
Position relative to the parent Transform.
transform.localPosition = Vector3.zerolocalRotation
Rotation relative to the parent Transform.
transform.localRotation = Quaternion.identitylocalScale
Scale relative to the parent Transform.
transform.localScale = Vector3.oneparent
The parent Transform of this object, or null if it is a root object.
let parentTransform: Transform = transform.parentposition
World-space position of the object as a Vector3.
let pos: Vector3 = transform.positionright
The red axis (X+) direction of the object in world space.
let side: Vector3 = transform.rightrotation
World-space rotation of the object as a Quaternion.
transform.rotation = Quaternion.Euler(0.0, 90.0, 0.0)up
The green axis (Y+) direction of the object in world space.
let upDir: Vector3 = transform.upMethods
DetachChildren
DetachChildren() -> voidEquals
Equals(other: object) -> boolFind
Find(n: string) -> TransformFinds a child Transform by name path. Returns null if not found.
let door: Transform = transform.Find("Room/Door")GetChild
GetChild(index: int) -> TransformReturns the child Transform at the given index.
let child: Transform = transform.GetChild(0)GetComponent
GetComponent(type: string) -> UnityEngineComponentGetComponent(type: SystemType) -> UnityEngineComponentGetComponent(type: SystemType) -> UnityEngineObjectGetComponentInChildren
GetComponentInChildren(includeInactive: bool, type: SystemType) -> UnityEngineObjectGetComponentInChildren(t: SystemType, includeInactive: bool) -> UnityEngineComponentGetComponentInChildren(t: SystemType) -> UnityEngineComponentGetComponentInChildren(type: SystemType) -> UnityEngineObjectGetComponentInParent
GetComponentInParent(includeInactive: bool, type: SystemType) -> UnityEngineObjectGetComponentInParent(t: SystemType, includeInactive: bool) -> UnityEngineComponentGetComponentInParent(t: SystemType) -> UnityEngineComponentGetComponentInParent(type: SystemType) -> UnityEngineObjectGetComponents
GetComponents(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> voidGetComponents(type: SystemType, results: SystemCollectionsGenericList`1[[UnityEngineComponent, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> voidGetComponents(type: SystemType) -> UnityEngineComponent[]GetComponents(type: SystemType) -> UnityEngineObject[]GetComponentsInChildren
GetComponentsInChildren(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> voidGetComponentsInChildren(includeInactive: bool, result: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> voidGetComponentsInChildren(includeInactive: bool, type: SystemType) -> UnityEngineObject[]GetComponentsInChildren(t: SystemType, includeInactive: bool) -> UnityEngineComponent[]GetComponentsInChildren(t: SystemType) -> UnityEngineComponent[]GetComponentsInChildren(type: SystemType) -> UnityEngineObject[]GetComponentsInParent
GetComponentsInParent(includeInactive: bool, results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> voidGetComponentsInParent(includeInactive: bool, type: SystemType) -> UnityEngineObject[]GetComponentsInParent(t: SystemType, includeInactive: bool) -> UnityEngineComponent[]GetComponentsInParent(t: SystemType) -> UnityEngineComponent[]GetComponentsInParent(type: SystemType) -> UnityEngineObject[]GetEnumerator
GetEnumerator() -> SystemCollectionsIEnumeratorGetHashCode
GetHashCode() -> intGetInstanceID
GetInstanceID() -> intGetLocalPositionAndRotation
GetLocalPositionAndRotation(localPosition: Vector3, localRotation: Quaternion) -> QuaternionGetPositionAndRotation
GetPositionAndRotation(position: Vector3, rotation: Quaternion) -> QuaternionGetSiblingIndex
GetSiblingIndex() -> intGetType
GetType() -> SystemTypeInverseTransformDirection
InverseTransformDirection(x: float, y: float, z: float) -> Vector3InverseTransformDirection(direction: Vector3) -> Vector3InverseTransformPoint
InverseTransformPoint(x: float, y: float, z: float) -> Vector3InverseTransformPoint(position: Vector3) -> Vector3InverseTransformVector
InverseTransformVector(x: float, y: float, z: float) -> Vector3InverseTransformVector(vector: Vector3) -> Vector3IsChildOf
IsChildOf(parent: Transform) -> boolLookAt
LookAt(target: Transform, worldUp: Vector3) -> voidLookAt(target: Transform) -> voidLookAt(worldPosition: Vector3, worldUp: Vector3) -> voidLookAt(worldPosition: Vector3) -> voidRotates the transform so its forward vector points at a target position.
transform.LookAt(targetTransform)Rotate
Rotate(xAngle: float, yAngle: float, zAngle: float, relativeTo: UnityEngineSpace) -> voidRotate(xAngle: float, yAngle: float, zAngle: float) -> voidRotate(axis: Vector3, angle: float, relativeTo: UnityEngineSpace) -> voidRotate(axis: Vector3, angle: float) -> voidRotate(eulers: Vector3, relativeTo: UnityEngineSpace) -> voidRotate(eulers: Vector3) -> voidApplies a rotation around the given axes in degrees.
transform.Rotate(0.0, 45.0, 0.0)RotateAround
RotateAround(point: Vector3, axis: Vector3, angle: float) -> voidSetAsFirstSibling
SetAsFirstSibling() -> voidSetAsLastSibling
SetAsLastSibling() -> voidSetLocalPositionAndRotation
SetLocalPositionAndRotation(localPosition: Vector3, localRotation: Quaternion) -> voidSetParent
SetParent(parent: Transform, worldPositionStays: bool) -> voidSetParent(p: Transform) -> voidAssigns a new parent Transform, optionally preserving world position.
transform.SetParent(newParent)SetPositionAndRotation
SetPositionAndRotation(position: Vector3, rotation: Quaternion) -> voidSetSiblingIndex
SetSiblingIndex(index: int) -> voidToString
ToString() -> stringTransformDirection
TransformDirection(x: float, y: float, z: float) -> Vector3TransformDirection(direction: Vector3) -> Vector3TransformPoint
TransformPoint(x: float, y: float, z: float) -> Vector3TransformPoint(position: Vector3) -> Vector3TransformVector
TransformVector(x: float, y: float, z: float) -> Vector3TransformVector(vector: Vector3) -> Vector3Translate
Translate(x: float, y: float, z: float, relativeTo: UnityEngineSpace) -> voidTranslate(x: float, y: float, z: float, relativeTo: Transform) -> voidTranslate(x: float, y: float, z: float) -> voidTranslate(translation: Vector3, relativeTo: UnityEngineSpace) -> voidTranslate(translation: Vector3, relativeTo: Transform) -> voidTranslate(translation: Vector3) -> voidMoves the transform by the given offset in its local or world space.
transform.Translate(0.0, 1.0, 0.0)