What you're looking for is Trust Vector Control(ler). Most modern rocket engines physically gimbal the engine around with ~two linear actuators around a fixed point at the top of the engine. All of the plumbing and connections to the rest of the rocket must then be flexible.
https://en.wikipedia.org/wiki/Thrust_vectoring#Gimbaled_thru...