how to freeze rotation for x axis only not entire x,y,z

how to freeze rotation for x axis only not entire x,y,z

i know to freeze the entire x,y,z using

how to freeze rotation for x axis only not entire x,y,z

but how to freeze only on the x axis?

note:in scripting .because im trying to freeze at rutime

If you are talking about rigidbodies, look at this

If you are talking about transform you might want to to something like
transform.rotation = Quaternion.Euler(value,transform.eulerAngles.y,transform.eulerAngles.z)

3 Likes
rigidbody.constraints = RigidbodyConstraints.FreezeRotationX;
2 Likes

I want unfreeze who have idea?

1 Like

You can reset the constraints with
rigidbody.constraints = RigidbodyConstraints.None;

I have a Skewering effect happening, I think it’s because of the freeze rotation I did a while ago, now I can’t find the select buttons. Any help??

Will that solution work with camera ? want to freeze cam`s rotation on z axis

hi i want freeze rotion x to player how

Rigidbody rb = GetComponent<Rigidbody>();
rb.constraints = RigidbodyConstraints.FreezeRotationX;

Use rigidbody’s freeze option. You can freeze rotation and position x axis over there

Hi ! but I want freeze Rotation on X-Axis And Z-Axis it work on one rotation

  • Rigidbody rb = GetComponent();
  • rb.constraints = ~RigidbodyConstraints.FreezeRotationY;

This works but it also freezes the positions how do i avoid that or unfreeze the positions?

can i freeze rotation on x,y and z axis?

Yes.

Steps to success:

  1. try typing the above into google… what do you learn?

  2. try looking up some of the methods listed above in the Unity API… what do you learn?

Steps to non-success:

  1. Posting to 9-year-old ancient necrotic threads.
1 Like