If using Blueprints you can get the HMDs Orientation:
Use that Rotator to your liking and feed it into your SetRotation function of your character.
In case that doesn’t work you should also be able to get the rotation from simply getting the rotation of your Camera, if it is locked to HMD, which it is by default.
EDIT: Yaw/Pitch and Roll of the GetOrientationAndPosition Function are already equal to what you’d like to achieve, so I removed the part about splitting it.
I just had a quick look into the Flying Template and it seems to be pretty easy: Just feed the “Current yaw speed”, “Current pitch speed” and “Current roll speed” variables with the input I mentioned above.