Ergonomics - road cycling on mountain bike
If you're rocking your hips while pedalling then your saddle is too high relative to the pedals, for your leg length.
Raise your saddle until you do start rocking while riding, and then lower it a couple cm or an inch.
If you now can't reach the road with your foot when stopped, then you will need to lean the bike, or get off the saddle at a red light.
This is not specific to MTB, but having a saddle that high might make MTB riding less controllable.  If you ride off road, lower your saddle again by a bit.  Draw two lines on the seatpost to help find your heights when adjusting.