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!