Currently, unmanned aerial vehicle ad hoc networks (UAANETs) have played important roles in both the military and civilian fields. Due to the fast moving speed of UAV nodes, the topology frequently changes, and it is difficult to maintain end-to-end connectivity. When deterministic routing protocols are applied in UAANETs, they cannot achieve ideal performance. In this paper, we propose a new mobility-aware gradient forwarding algorithm (MGFA), which aims to reduce the impairments caused by the highly dynamic topology. Our proposed algorithm introduces mobility information into the computation of the routing cost, which guides the relaying nodes to make forwarding decisions. The simulation results indicate that the MGFA can indeed outperform other deterministic routing protocols in terms of the packet delivery ratio, routing overhead, throughput, and average end-to-end delay.