// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); if (!spline.isLooping) { segment = 1; } rb.MovePosition(spline.GetCurvePos(t, segment) + new Vector3(0, offsetY, 0)); transform.forward = spline.GetCurveForward(t, segment); }