Search Unity

Rotating 2D vector

Discussion in 'Scripting' started by hubert665, May 25, 2014.

  1. hubert665

    hubert665

    Joined:
    May 25, 2014
    Posts:
    3
    Hello, I have a rigidbody2D, and it's got some velocity vector. How can I rotate this vector around axis passing through it's z coordinate (which is 0) . Is there already a function for such thing? Thanks in advance.
     
  2. vandreadcola

    vandreadcola

    Joined:
    Mar 17, 2014
    Posts:
    38
    AddTorque? is that what you want?

    Code (csharp):
    1. YOURgameObject.rigidbody2D.AddTorque(-YOURrotationSpeed * Time.deltaTime);
     
  3. hubert665

    hubert665

    Joined:
    May 25, 2014
    Posts:
    3
    No, I wanted to use it for 2D rigidbody