Hello. Im trying to make my object rotate to an object using a lerp. Works good but I want my object to only rotate the object by the y-axis to the other object. Any way I can make this happen?
If you have a rotation represented as a Quaternion, you can use its “eulerAngles” property to get or set the individual axis rotations. You probably want to calculate the lerp in the same way you’re currently doing, but then instead of setting your object’s rotation to that, take only the Y euler angle and combine that with the object’s previous X and Z euler angles.
Note that there’s some subtlety here about whether you’re consider the Y axis in the world reference frame or the object’s local reference frame, and that sometimes you might get different euler angles than you intuitively expect because the same rotation can be represented by multiple sets of euler angles.
Haven’t implemented this yet, but wont this rotate smoothly to another objevt by y axis?