

If you really need the output to be back into FVector form, you can pull that back. FQuat has a constructor that takes an orientation vector and a twist angle. However, I'm not convinved Quaternion will always give the same euler angles, hence the EDIT above.ĮDIT #2: I see there is Quaternion. Slerp is the unpopular younger brother of lerp, but it doesn't. Slerp is a term you'll hear somewhat often in game development, particularly when dealing with vectors and rotation. In Unity Engine I use Vector3.Slerp ( Vector3 is similar to FVector) but in UE i just found the Slerp function in FQuat class and this is not working because is not a rotation.

The parameter t is clamped to the range 0, 1. The direction of the returned vector is interpolated by the angle and its magnitude is interpolated between the magnitudes of from and to. I've tested a few rotations by inputting different but equivalent euler angles, they have always come up the same after converting to a Quaternion first. The difference between this and linear interpolation (aka, 'lerp') is that the vectors are treated as directions rather than points in space. However, comparing the euler angles without converting to a quaternion first will cause an error since (315, 180, 180) is not anywhere close to (225, 0, 0).ĮDIT: So I decided that comparing the angle between two quaternions is better than comparing euler angles because of cases like (315, 180, 180) being the same rotation as (225, 0, I'm fairly sure that lerAngles will always convert to a rotation in x, y, z order, with values between [0, 360). In fact, I'd be surprised if calculating an angle does not use the dot product. the angle, we need to set the rotation of object using the following code. Measuring the dot product of the quaternion's euler angles, or the angle directly should both work, because Unity will give the same eulerAngles for the quaternions. The difference between this and linear interpolation (aka, 'lerp') is that the vectors are treated as directions rather than points in space. Translate (vector), which will add the vector the current position.
