Transform
public class Transform : ComponentNamespace NodeWorld.Flux.
The position, rotation, scale and parent of an object, as Unity's Transform.
Properties
position
public Vector3 position { get; set; }Position in the world.
rotation
public Quaternion rotation { get; set; }Rotation in the world.
localPosition
public Vector3 localPosition { get; set; }Position in the parent's space.
localRotation
public Quaternion localRotation { get; set; }Rotation in the parent's space.
localScale
public Vector3 localScale { get; set; }Scale in the parent's space.
lossyScale
public Vector3 lossyScale { get; }Scale in the world (read only).
eulerAngles
public Vector3 eulerAngles { get; set; }Rotation in the world, as angles in degrees.
localEulerAngles
public Vector3 localEulerAngles { get; set; }Rotation in the parent's space, as angles in degrees.
forward
public Vector3 forward { get; set; }The object's blue axis (z) in the world; setting it turns the object to face that way.
up
public Vector3 up { get; }The object's green axis (y) in the world.
right
public Vector3 right { get; }The object's red axis (x) in the world.
localToWorldMatrix
public Matrix4x4 localToWorldMatrix { get; }The matrix from the object's space to the world.
worldToLocalMatrix
public Matrix4x4 worldToLocalMatrix { get; }The matrix from the world to the object's space.
parent
public Transform parent { get; set; }The parent transform (null: a root of the scene). Setting it keeps the object where it is in the world.
childCount
public int childCount { get; }The number of children.
root
public Transform root { get; }The topmost parent (the transform itself when it has none).
Methods
GetChild
public Transform GetChild(int index)The child at index, 0 to childCount - 1.
Find
public Transform Find(string path)The child at this path below this transform ("Child/Grandchild"), or null.
SetParent
public void SetParent(Transform parent)Sets the parent, as the parent property: the object stays where it is in the world.
GetSiblingIndex
public int GetSiblingIndex()The object's place among its parent's children.
SetSiblingIndex
public void SetSiblingIndex(int index)Moves the object to that place among its parent's children.
SetAsLastSibling
public void SetAsLastSibling()Moves the object last among its parent's children.
SetAsFirstSibling
public void SetAsFirstSibling()Moves the object first among its parent's children.
IsChildOf
public bool IsChildOf(Transform parent)This transform is parent, or below it.
SetPositionAndRotation
public void SetPositionAndRotation(Vector3 position, Quaternion rotation)Sets the position and the rotation in the world.
TransformPoint
public Vector3 TransformPoint(Vector3 position)A point from the object's space to the world (position, rotation and scale).
InverseTransformPoint
public Vector3 InverseTransformPoint(Vector3 position)A point from the world to the object's space.
TransformDirection
public Vector3 TransformDirection(Vector3 direction)A direction from the object's space to the world (rotation only).
InverseTransformDirection
public Vector3 InverseTransformDirection(Vector3 direction)A direction from the world to the object's space (rotation only).
TransformVector
public Vector3 TransformVector(Vector3 vector)A vector from the object's space to the world (rotation and scale).
InverseTransformVector
public Vector3 InverseTransformVector(Vector3 vector)A vector from the world to the object's space (rotation and scale).
Translate
public void Translate(Vector3 translation, Space relativeTo = Space.Self)Moves the object by translation, along its own axes (Space.Self) or the world's.
Rotate
public void Rotate(Vector3 eulers, Space relativeTo = Space.Self)Turns the object by these angles in degrees, around its own axes (Space.Self) or the world's.
public void Rotate(Vector3 axis, float angle, Space relativeTo = Space.Self)Turns the object by angle degrees around axis (in its own space with Space.Self).
LookAt
public void LookAt(Vector3 worldPosition, Vector3 worldUp)Turns the object so that its forward points at worldPosition and its up toward worldUp.
public void LookAt(Vector3 worldPosition)Turns the object so that its forward points at worldPosition, its up toward the world's up.
public void LookAt(Transform target)Turns the object so that its forward points at target.
