0
\$\begingroup\$
 // Unity2D
 // sort of like a rainbow arc motion starting from left to right and vice versa.
 private float rotateSpeed = 1.0f;
 private float radius = 9.0f;
 private Vector2 _centre;
 private float _angle;
 public void Start()
 {
   _centre = transform.position;
 }
 private void FixedUpdate()
 {
   TransportPlayer();
 }
 public void TransportPlayer()
 {

     if (true)
     {

         _centre = transform.position;

         _angle += rotateSpeed * Time.deltaTime;
         var offset = new Vector2(Mathf.Sin(_angle), Mathf.Cos(_angle)) * radius;
         transform.position = _centre + offset;

     }
     else
     {
         return;
     }

 }
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.