Moving main camera using the actual directions

Hi, sorry for the confusing title.

What I’m trying to do is:
I have a camera, and I create a script to move the main camera using WASD keys.

var movement = Vector3.zero;
		var speed = 30.0f;
		
		if (Input.GetKey("w"))
			movement.z++;
		if (Input.GetKey("s"))
			movement.z--;
		if (Input.GetKey("a"))
			movement.x--;
		if (Input.GetKey("d"))
			movement.x++;
		
		transform.Translate(movement * speed * Time.deltaTime, Space.Self);

The problem is that the camera has its rotation angle x set to 36, then when I move the movement.z + + (Keyboard: W) camera instead of going forward, it drops using rotation 36, I wanted to know how to put forward in the horizontal direction, preserving the rotation x.

Like this:
1592104--95592--$ew.png

Thanks.

movement += transform.forward

There is also transform.right for moving laterally.

Thanks for replying my question, but the problem still alive.
movement += transform.forward isn’t about to do the same thing of movement.z++?
It’s working, but as I said, I’ve set the camera rotation to 36 (X angle), so, using both I got the same result (1592104--95592--$ew.png, “What is now”).

I want to move foward without change the rotations.

Put the camera inside an empty game object. Move the empty game object instead of the camera.

Since the empty game object isn’t rotated, moving it won’t run into this issue.

Socrates, thank you, now it’s working pretty well.
CaptainScience thanks again for the reply!

The problem was solved.