Why do certain aircraft's landing gear tilt up? Why do the main landing gears of aircraft like the A330, 777, 787, etc tilt up? This does not happen with the 767. Interestingly, for the 747, the inner landing gear does not tilt up while the outer landing gear (under the wing) does. Why does that happen?
Pulling mostly from the answers provided here it seems that 


The torque produced by the straightening gear helps to flatten the plane out.
The main gear tilt on the B747 also provides air/ground sensing. All four main gear bogeys tilt when the aircraft is airborne, so on touchdown any systems relying on air/ground logic can activate
The gear is tilted to fit into the wheel well


You can check the link for the rest of the explanations.