Freezing Rotation

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?

:expressionless:

It confuses me…

You could try

rigidbody.freezeRotation = true;

via scripting.

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…

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? :wink:

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.

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