Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

GetComponent Rigidbody

Discussion in 'Editor & General Support' started by syndhex, Sep 15, 2015.

  1. syndhex

    syndhex

    Joined:
    Sep 13, 2015
    Posts:
    4
    I have a simple question, in C# how do you freeze/unfreeze the rotation of the axes x,y,z in the code?

    I tried using
    GetComponent<Rigidbody>() freezeRotation

    What else do I need?
     
  2. torbjorn

    torbjorn

    Unity Technologies

    Joined:
    Jun 25, 2015
    Posts:
    211
  3. syndhex

    syndhex

    Joined:
    Sep 13, 2015
    Posts:
    4
    Thanks
     
  4. CodeGorilla

    CodeGorilla

    Joined:
    Sep 15, 2015
    Posts:
    17
    You can also do this in Unity itself, just click the freeze rotation button.
    Unless of course you want it in code.