Having an action that occurs after a Quaternion slerp reaches goal

How do you have an action or trigger that occurs after a Quaternion slerp reaches its target?

Due to rounding errors, would a check like if(itemAngle == targetAngle) be too strong? What sort of rounding interval should be accounted for?

Is there another way to check when target has been reached?

The equality operator for quaternions accepts nearly equal rotations: Unity verifies if the dot product of the two quaternions is close enough to 1, what should mean they are almost the same. But this “close enough to 1” is fixed by Unity; if you want to control the error margin, do the dot product yourself:

if (Quaternion.Dot(targetRot, transform.rotation) > 0.99){
  // rotation is very close to targetRot
}

But you can be more specific yet: use Quaternion.Angle, thus you can specify an error margin in degrees, which’s way more intuitive:

if (Quaternion.Angle(targetRot, transform.rotation) <= 2){
  // rotation is at 2 degrees or less from targetRot
}

How are you performing the slerp?

Aren’t you supplying the t value (the percentage to slerp between the specified values)?

If so, you could just have a check next to the slerp code:

if(t < 1)
{
//perform slerp
}

else
{
itemAngle = targetAngle;
//call function that does the action you want triggered
}