when finished rotating it doesent want to call a boolean

Hello i have made this code that a player is in a bed and main camera rotate 90 degrees to right then 180 to left etc… so it looks like the player is looking around in the room and when it finishes the player can look around manually and press “E” whenever he want to get out of the bed and when the player press “E” i want the main camera to rotate 90 degrees to right then stand up but i have a bug in this, here is code:

Quaternion newRotation = Quaternion.AngleAxis(90, Vector3.up);
                    fpsToRotate.transform.rotation = Quaternion.Slerp(fpsToRotate.transform.rotation, newRotation, Speed * Time.deltaTime);
                    if (fpsToRotate.transform.rotation == newRotation)
                        stop = true;

it rotates 90 degrees but it doesent call “stop = true”
sorry for my bad english and hope someone understanded me :slight_smile:
i have also tryed to search on google but with no luck :confused:

It’s a floating point issues, you’ll hardly have exact float numbers unless you’re exactly setting them, so I think this is the case of Slerp. You could probably workaround using the magnitude from eulerAngles with a sort of tolerance value.