Search Unity

How to move an object by a certain angle over a period of time

Discussion in 'Editor & General Support' started by nowletsstart, Jun 11, 2018.

  1. nowletsstart

    nowletsstart

    Joined:
    Jan 1, 2016
    Posts:
    78
    From the image below, I know points `A` and `B` and would like to move `B` by e degrees (around A with in a circle of radius AB) to a point C which I don't know over a period of time, say 2 seconds. How can this be done, preferably with a coroutine?


    Screen Shot 2018-06-11 at 9.36.27 AM.png
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    The easiest way would be to just put an object at point A, make the object at point B a child of A, and then rotate A by e degrees over those 2 seconds.
     
  3. nowletsstart

    nowletsstart

    Joined:
    Jan 1, 2016
    Posts:
    78
    I will be moving an object around several circles with different centres, so I'm not sure if this would be an ideal solution. I think a more general form of just using a Vector3 position as a centre would be more appropriate in my case. Also I don't know now how to move an object around a circle.