PosAndRot Class |
Namespace: KSPDev.Types
The PosAndRot type exposes the following members.
Name | Description | |
---|---|---|
PosAndRot | Constructs a default instance. | |
PosAndRot(PosAndRot) | Constructs a copy of an object of the same type. | |
PosAndRot(Vector3, Vector3) | Constructs an object from a transform properties. |
Name | Description | |
---|---|---|
Clone | Gives a deep copy of the object. | |
FromString | Creates a new instance from the provided string. | |
InverseTransform |
Transforms the object from world space to local space of a reference transform.
| |
ParseFromString | Restores the object's state from a plain string. | |
SerializeToString | Returns the object's state as a plain string. | |
ToString | Shows a human readable representation. (Overrides ObjectToString.) | |
Transform |
Transforms the object from the world space to the local space of a reference transform.
|
public static void ToLocal() { var parent = new GameObject(); parent.transform.position = Vector3.one; parent.transform.rotation = Quaternion.LookRotation(Vector3.up); var pr = new PosAndRot(Vector3.one, new Vector3(90, 0, 0)); Debug.LogFormat("Local: {0}", parent.transform.InverseTransformPosAndRot(pr)); Debug.LogFormat("World: {0}", pr); }
public static void ToWorld() { var parent = new GameObject(); parent.transform.position = Vector3.one; parent.transform.rotation = Quaternion.LookRotation(Vector3.up); var pr = new PosAndRot(); Debug.LogFormat("Local: {0}", pr); Debug.LogFormat("World: {0}", parent.transform.TransformPosAndRot(pr)); }