Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question, RotateAround....

Discussion in '2D' started by xJavier, Nov 4, 2014.

  1. xJavier

    xJavier

    Joined:
    May 10, 2014
    Posts:
    8
    Hi , I've an object that is actually rotating around another one, but it seems to be very inefficient in mobiles, any idea how can I improve it?

    heres the code:


    Code (CSharp):
    1.  
    2. if (orbit != null) {
    3.                         transform.RotateAround(orbit.position, Vector3.back, speed * Time.deltaTime);
    4.                         if(transform.rotation.z != 0){
    5.                             transform.rotation = Quaternion.Euler(new Vector3(0,0,0));
    6.                         }
    7.                     }
    8.  
    it's running inside an Update function;