How to make a camera move relative to the Y and Z Rotation, but not the x rotation

I am making a RTS game, such as stronghold. And was wondering how to make the camera move forward, backwards, left, and right based on the Y and Z rotations. But not the X rotation. I have tried this:
var pos = Time.deltaTime * speed;
if(Input.GetKey(“w”)){ //Forward
transform.Translate(Vector3.forward * pos);
}
But I have the camera’s x angle set to 40… So it zooms in and forward. Not good. So I need a way to move forward, backwards, left, and right without zooming in or out. Please help! Thanks! I am fairly new to unity so I hope this isn’t a noob question! :slight_smile:

You could make an empty without rotation on the ground.
Attach your camera as a child, with the desired height and rotation.
Now you have to change your script to move the empty instead of your camera and you’re done.