US researchers have used a robot to discover how "sidewinder" rattlesnakes climb up sand dunes.
First, scientists made a special dune out of sand from the Arizona desert. They painted marks on snakes in order to watch their movements.
They then used a robotic snake to work out the best way for snakes and robots to climb the slopes without slipping.
Surfaces like sand dunes are unstable and are difficult for animals and robots to cross.
Dr Daniel Goldman from the Georgia Institute of Technology said his team originally thought that the snakes would climb the dune by digging their bodies into the sand.
This is the same way humans climb a sandy slope.
But instead the animals flattened themselves so that they were touching more of the sand.
Only sidewinding rattlesnakes used this strategy.
Thirteen related species of pit viper, faced with the same challenge, tried other wriggling techniques but couldn't move far.