I am trying of rotate the player with a key in 0, 90, 180 in a 3d game, depending of the direction, but not work well.

        if Input.is_key_pressed(KEY_M):
		if rotation_degrees.y>0 and rotation_degrees.y<90:
			rotation_degrees.y=0
		if rotation_degrees.y>90 and rotation_degrees.y<180:
			rotation_degrees.y=90
		if rotation_degrees.y>-180 and rotation_degrees.y<-90:
			rotation_degrees.y=-90
		if rotation_degrees.y>-1 and rotation_degrees.y>-90:
			rotation_degrees.y=0

Have you tried just using the rotate_y() function? 90 degrees should be about 1.5708 radians which is what godot uses in most places.

    Erich_L 90 degrees should be about 1.5708 radians which is what godot uses in most places.

    or just use deg2rad(90) to convert from degrees value to a radians value.