Moving character depending on where the camera is facing

I had already done a lot of research before, and could not find a clear solution to my problem.

I can post my code if any of you guys need it.

So first of all, I’m making a 3D top-down shooter. My camera rotates around the player, and whenever I press a button forward, the character moves forward. But it moves on the world axis. I want it to move in the local axis. But this isn’t possible since the character is always facing a different direction because I made it so that the character is always facing the location of the mouse.

So, what I need it to do is have the character move in the direction opposite the camera when pressing forward (W), and left or right with the keys that correspond to it.

Almost forgot to mention, I don’t know if this is relevant or not, but the camera is facing the character at an angle, so it has a top and side view of the character.

I finally got this thing working. For those of you who want to know the answer, let me explain.

So, I created an empty object (let’s call this obj1), the empty object will rotate and move whenever the player presses the desired button.

There is also another empty object (let’s call this obj2), this object will copy the position of the obj1, but not the rotation. Obj2 also serves as a pivot point for rotating the camera. The camera is a child of obj2, and rotates whenever the player presses the left or right rotation button.

The important fact to remember is that rotation of obj1 and the camera must match because they are initialized individually.