I ask because youâre manipulating the Quaternion components directly.
Not the âyâ coordinate of a Quaternion doesnât necessarily directly correlate to the âyâ component of euler angles. A quaternion has 4 components, x,y,z,w. They represent a set of complex numbers that well Iâm not going to get any further into as quatâs are complicated as all hell to explain, especially since my understanding of them though good, isnât good enough to explain them to other people in a coherent manner.
So⌠either a| you know how quaternionâs work in which case not sure why youâd have this question, or b| youâre not sure how they work, and modifying that component is strongly urged against being done.
What do you mean it gets stuck at some degrees? Is there some pattern in what degrees it gets stuck at? Can you share an image/video of this with us?
3)Here might be a better piece of code for you to align with a surface:
Vector3 normal = Vector3.up; //the normal of the surface, using 'up' for demo purposes
Quaternion deltaRot = Quaternion.FromToRotation(this.transform.up, normal);
Quaternion targRot = deltaRot * this.transform.rotation;
this.transform.rotation = Quaternion.Slerp(this.transform.rotation, targRot, Time.deltaTime * alignSpeed);
Iâm willing to bet this may fix the âstickingâ youâre speaking of.