Transform
public sealed struct Transform A struct containing a position, rotation and scale. This is commonly used in engine to describe entity position, bone position and scene object position.
Constructors
Properties
| Name | Type | Description |
|---|---|---|
UniformScale | Single | A uniform scale component. Generally the scale is uniform, and we'll just access the .x component. |
Forward | Vector3 | |
Backward | Vector3 | |
Up | Vector3 | |
Down | Vector3 | |
Right | Vector3 | |
Left | Vector3 | |
IsValid | Boolean | Returns true if position, scale and rotation are valid |
ForwardRay | Ray | Return a ray from this transform, which goes from the center along the Forward |
Methods
Vector3 PointToLocal(Vector3 worldPoint) Convert a point in world space to a point in this transform's local space
Vector3 PointToWorld(Vector3 localPoint) Convert a point in this transform's local space to a point in world space
static Transform Lerp(Transform a, Transform b, Single t, Boolean clamp) Perform linear interpolation from one transform to another.
Transform LerpTo(Transform target, Single t, Boolean clamp = True) Linearly interpolate from this transform to given transform.
Transform Add(Vector3 position, Boolean worldSpace) Add a position to this transform and return the result.
Transform WithPosition(Vector3 position, Rotation rotation) Return this transform with a new position and rotation
Transform WithScale(Single scale) Return this transform with a new scale.
Transform RotateAround(Vector3 center, Rotation rot) Rotate this transform around given point by given rotation and return the result.
center — Point to rotate around. rot — How much to rotate by. Single) can be useful. static Transform Concat(Transform parent, Transform local) Concatenate (add together) the 2 given transforms and return a new resulting transform.
static Transform Parse(String str) Given a string, try to convert this into a transform. The format is "px,py,pz,rx,ry,rz,rw".
Boolean AlmostEqual(Transform tx, Single delta = 0.0001) Returns true if we're nearly equal to the passed transform.
tx — The value to compare with delta — The max difference between component values Fields
| Name | Type | Description |
|---|---|---|
Zero static | Transform | Represents a zero transform, that being, a transform with scale of 1, position of Zero and rotation of Identity. |
Position | Vector3 | Position of the transform. |
Scale | Vector3 | Scale of the transform. Does not itself scale Position or Rotation. |
Rotation | Rotation | Rotation of this transform. |
Sandbox.System Full Name: Transform