Basically a simple data structure used to store a transform's data. Many operators provides functionality to read, write or compare this data to a unity Transform, (or other transformation storage classes provided with this module), using a single line of code. Additional operators allow the actual transformation of vectors using the stored data. Members are specified as localPosition,localRotation and localScale but they COULD in fact be storing world coordinates. They are no more than vectors and Quaternions, that can be used as transformation data.
It is only when dealing with ACTUAL Transforms, that this becomes important, and all such functions within have options to the Transform's local or world coordinates (except the implicit operator, which assume local).

Public Member Functions

 StoredTransform (StoredFullTransform transform_to_copy, bool localNotWorld)
 Create a new transform storage object, with the option to copy the source StoredFullTransform's local or world values. The constructor for this struct requires a transform from which it will copy the transform data. If no transform is provided, values will be set unity (no transformation).
 
 StoredTransform (Transform transform_to_copy)
 Create a new transform storage object. The constructor for this struct requires a transform from which it will copy the transform data. If no transform is provided, values will be set unity (no transformation). It will generally prove more efficient to simple use the implicit casting operator, than this constructor. while nearly identical to the constructor version that takes a bool param, this constructor signature is useful
 
 StoredTransform (Transform transform_to_copy, bool localNotWorld)
 Create a new transform storage object, with the option to copy the source Transform's local or world values. The constructor for this struct requires a transform from which it will copy the transform data. If no transform is provided, values will be set to identity (no transformation).
 
 StoredTransform (Vector3 position, Quaternion orientation, Vector3 scale)
 Constructor used to create a new StoredTransform, given a Translation, Rotation and Scaling components of the transform.
 
bool AproxEquals (StoredTransform trasformStorage)
 Specific version of equality function used to compare with a StoredTransform structs, Uses Mathf.Approx to compute equality.
 
void AssignToTransform (Transform transformToAssignTo, bool localNotWorld=true)
 Use to assign the values stored in the StoredTransform to an actual UnityEngine.Transform
 
void Copy (StoredTransform transform_to_copy)
 Copies the source StoredTransform into the calling StoredTransform's variables. Does not create a new Object. The constructor for this struct requires a transform from which it will copy the transform data. If no transform is provided, values will be set unity (no transformation).
 
void Copy (Transform transform_to_copy, bool localNotWorld=true)
 Copies the source Transform's local or world values, into the calling StoredTransform's variables. Does not create a new Object. The constructor for this struct requires a transform from which it will copy the transform data. If no transform is provided, values will be set unity (no transformation).
 
override bool Equals (object objectToCompare)
 Generalized version of equality function. Determines if the object to compare is a Transform or StoredTransform. If so it compares each transform element for equality. If all element match it returns true.
 
bool Equals (StoredFullTransform fullTransform, bool localNotWorld=true)
 Specific version of equality function used to compare with a Transform object. It allows the caller to specify weather to compare the StoredTransform with the Transforms local or world coordinates.
 
bool Equals (StoredTransform trasformStorage)
 Specific version of equality function used to compare with a StoredTransform structs.
 
bool Equals (Transform unityTransform, bool localNotWorld)
 Specific version of equality function used to compare with a Transform object. It allows the caller to specify weather to compare the StoredTransform with the Transforms local or world coordinates.
 
override int GetHashCode ()
 This struct has dynamic values, and therefore should not be used as a key. This function will simply return a constant, so no there is performance gain from using Hash Tables.
 
void Reset ()
 Reset the stored values to unity, which represents NO transformation.
 
Matrix4x4 ToMatrix ()
 Provides a TRS Matrix4X4 based upon this stored transform.
 
override string ToString ()
 Output transform storage as single line string, useful for debugging.
 
Vector3 TransformDirection (Vector3 direction)
 Function used to Transform a provided direction by this storedTransform. In detail: this function applies ONLY the rotation component of the StoredTransform to the provided Vector3.

 
Vector3 TransformPoint (Vector3 point)
 Function used to Transform a provided point by this storedTransform. The provided Vector3 point is scaled, rotated, and translated, in that order.
 

Static Public Member Functions

static StoredTransform GenNew ()
 static function to generate a new StoredTransform instance set to unity/identity, representing no transform. (This function exists because Structs have no generic constructors.)
 
static StoredTransform Lerp (StoredTransform a, StoredTransform b, float fraction)
 Used to perform linear interpolation upon each part of the two StoredTransforms, and returns the result.
 
static implicit operator StoredTransform (Transform transform_to_copy)
 The implicit Transform assignment operator will create a new StoredTransform object, and assign it the local values of the provided Transform.
 
static bool operator!= (StoredTransform lhs, StoredTransform rhs)
 Used to check for inequality between StoredTransforms.
 
static bool operator== (StoredTransform lhs, StoredTransform rhs)
 This function will check for equality between two StoredTransforms
 

Public Attributes

Vector3 localPosition
 stores transform position information
 
Vector3 localScale
 stores transform scale information
 
Vector3 unclippedEulers
 allows storage of transformation rotation greater than 360 deg
 

Static Public Attributes

static readonly StoredTransform Identity
 A static StoredTransform that represents no transformations.
 

Properties

Quaternion localRotation [get, set]
 accessor to extract and store transform orientation information
 
Vector3 localRotationEulers [get, set]
 accessor to extract and store transform orientation information, using Euler angles
 
+ Collaboration diagram for StoredTransform: