Transformclass
A struct containing a position, rotation and scale. This is commonly used in engine to describe entity position, bone position and scene object position.
Constructors4
Showing 4 constructors
No results match this filter.
Methods21
Showing 21 methods
public Transform Add(Vector3 position, bool worldSpace)
Add a position to this transform and return the result.
| Parameter | Type | Description |
|---|---|---|
| position | Vector3 | — |
| worldSpace | bool | — |
public bool AlmostEqual(Transform tx, float delta = 0.0001)
Returns true if we're nearly equal to the passed transform.
| Parameter | Type | Description |
|---|---|---|
| tx | Transform | The value to compare with |
| delta = 0.0001 | float | The max difference between component values (used for Position and Scale) |
boolTrue if nearly equalpublic static Transform Concat(Transform parent, Transform local)
Concatenate (add together) the 2 given transforms and return a new resulting transform.
| Parameter | Type | Description |
|---|---|---|
| parent | Transform | — |
| local | Transform | — |
public static Transform Lerp(Transform a, Transform b, float t, bool clamp)
Perform linear interpolation from one transform to another.
| Parameter | Type | Description |
|---|---|---|
| a | Transform | — |
| b | Transform | — |
| t | float | — |
| clamp | bool | — |
public Transform LerpTo(Transform target, float t, bool clamp = True)
Linearly interpolate from this transform to given transform.
| Parameter | Type | Description |
|---|---|---|
| target | Transform | — |
| t | float | — |
| clamp = True | bool | — |
public Transform Mirror(Sandbox.Plane plane)
Create a transform that is the mirror of this
| Parameter | Type | Description |
|---|---|---|
| plane | Plane | — |
public Vector3 NormalToLocal(Vector3 worldNormal)
Convert a world normal to a local normal
| Parameter | Type | Description |
|---|---|---|
| worldNormal | Vector3 | — |
public Vector3 NormalToWorld(Vector3 localNormal)
Convert a local normal to a world normal
| Parameter | Type | Description |
|---|---|---|
| localNormal | Vector3 | — |
public 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"`.
| Parameter | Type | Description |
|---|---|---|
| str | string | — |
public Vector3 PointToLocal(Vector3 worldPoint)
Convert a point in world space to a point in this transform's local space
| Parameter | Type | Description |
|---|---|---|
| worldPoint | Vector3 | — |
public Vector3 PointToWorld(Vector3 localPoint)
Convert a point in this transform's local space to a point in world space
| Parameter | Type | Description |
|---|---|---|
| localPoint | Vector3 | — |
public Transform RotateAround(Vector3 center, Rotation rot)
Rotate this transform around given point by given rotation and return the result.
| Parameter | Type | Description |
|---|---|---|
| center | Vector3 | Point to rotate around. |
| rot | Rotation | How much to rotate by. `Rotation.FromAxis(Vector3,System.Single)` can be useful. |
public Rotation RotationToLocal(Rotation worldRot)
Convert a world rotation to a local rotation
| Parameter | Type | Description |
|---|---|---|
| worldRot | Rotation | — |
public Rotation RotationToWorld(Rotation localRotation)
Convert a local rotation to a world rotation
| Parameter | Type | Description |
|---|---|---|
| localRotation | Rotation | — |
public Transform ToLocal(Transform child)
Convert child transform from the world to a local transform
| Parameter | Type | Description |
|---|---|---|
| child | Transform | — |
public Transform ToWorld(Transform child)
Convert child transform from local to the world
| Parameter | Type | Description |
|---|---|---|
| child | Transform | — |
public Transform WithRotation(Rotation rotation)
Return this transform with a new rotation.
| Parameter | Type | Description |
|---|---|---|
| rotation | Rotation | — |
No results match this filter.
Properties9
Showing 9 properties
public Ray Transform.ForwardRay { get; set; }
Return a ray from this transform, which goes from the center along the Forward
public bool Transform.IsValid { get; set; }
Returns true if position, scale and rotation are valid
bool—public float Transform.UniformScale { get; set; }
A uniform scale component. Generally the scale is uniform, and we'll just access the .x component.
float—No results match this filter.