Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Freezing Rotation

Discussion in 'Editor & General Support' started by Mindless_Soul, Feb 19, 2006.

  1. Mindless_Soul

    Mindless_Soul

    Joined:
    Feb 1, 2006
    Posts:
    128
    I can't seem to figure out how to freeze the rotation of an object. I have tried using the Euler Rotation Motor (under misc. components) to freeze the rotation, which works, but the object is then kinematic and is not affected by gravity or force. :?

    Under the rigidbody dynamic there is a freeze rotation option, but it is always greyed out. Why is this?

    :|

    It confuses me...
     
  2. klindeman

    klindeman

    Joined:
    Jun 13, 2005
    Posts:
    295
    You could try

    rigidbody.freezeRotation = true;

    via scripting.
     
  3. Mindless_Soul

    Mindless_Soul

    Joined:
    Feb 1, 2006
    Posts:
    128
    Thanks, that was a lot simpler than I thought it would be.

    Does anyone know why the freeze rotaton button is greyed out?

    Just curious...
     
  4. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    Because it's not a public property. As such, it only appears in read-only form in Expert mode.

    The question is, why is it not a public property? ;)
     
  5. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    We try to expose only variables that are very commonly used to the inspectors.
    All other variables can be set from scripting. So you should always check the scripting reference for a component!

    If we would expose every variable to the inspector then the rigidbody component inspector would be one page long.
     
  6. Mindless_Soul

    Mindless_Soul

    Joined:
    Feb 1, 2006
    Posts:
    128
    Heh, I see now. That makes sense.

    So what would a script look like that freezes the object from rotating specifically on say the z or x axis?



    (sorry for all the n00b questions)




    needs to learn javascript
    vvvvvvvvvvvvvvvvvvvv