Help!About the Infinite Runner Starter Pack

Yo,everyone!I have a some question about the Infinite Runner Starter Pack.In this script “InfiniteObject.cs” I do not understand the principle about function “orient”.help me ,give me some explanation picture or some examples of this principle.Please! 3Q!
the code like this :
`

 // orient for platform and scene objects
 public virtual void orient(Vector3 position, Quaternion rotation)
{
     Vector3 pos = Vector3.zero;
     float yAngle = rotation.eulerAngles.y;
     pos.Set(startPosition.x * Mathf.Cos(yAngle * Mathf.Deg2Rad) + startPosition.z *        Mathf.Sin(yAngle * Mathf.Deg2Rad),
            startPosition.y,
            -startPosition.x * Mathf.Sin(yAngle * Mathf.Deg2Rad) + startPosition.z * Mathf.Cos(yAngle * Mathf.Deg2Rad));
    pos += position;
    thisTransform.position = pos;
    thisTransform.rotation = startRotation;
    thisTransform.Rotate(0, yAngle, 0, Space.World);
}
// orient for collidables which have a platform as a parent
public virtual void orient(PlatformObject parent, Vector3 position, Quaternion rotation)
{
    thisTransform.parent = parent.getTransform();
    Vector3 pos = startPosition;
    pos += position;
    thisTransform.localPosition = parent.getTransform().InverseTransformPoint(pos);
    thisTransform.rotation = startRotation;
    thisTransform.Rotate(0, rotation.eulerAngles.y, 0, Space.World);
}

`

Thank U!

The tricky bit is probably:

    pos.Set(startPosition.x * Mathf.Cos(yAngle * Mathf.Deg2Rad) + startPosition.z *        Mathf.Sin(yAngle * Mathf.Deg2Rad),
            startPosition.y,
            -startPosition.x * Mathf.Sin(yAngle * Mathf.Deg2Rad) + startPosition.z * Mathf.Cos(yAngle * Mathf.Deg2Rad));
    pos += position;
    thisTransform.position = pos;

All this is doing is:

  1. Using trig to calculate the offset caused by the rotation (“by rotating a point around the origin”).
  2. Summing this offset with the position parameter.
  3. Using the result to define the position of this transform.

If you want to know about this rotation technique you may like to watch this 1 or read this