Movement relative to orientation/rotation

Hi everyone,
This is the first time I’m properly delving in creating a character controller with complexity and I’ve hit a stump.

Long story short I am trying to create a player controller inspired by gravity rush, the point is, you can enter a zero gravity state and choose the direction that gravity pulls you by whichever direction the camera faces. This allows the player to flip upside down and walk on any surface desired.

I have the gravity logic fully functional to my understanding as I can manipulate the direction for the character to fall in and land on surfaces and the camera also flips to match this. The issue begins when I move. Basically, I coded the character to only move forward from their perspective, for sideways movement just turn the character to match that direction RELATIVE to the camera, with fixed angles around it e.g. left and right would rotate the character to maximum differences of 90 degrees whilst backwards would 180. The issue is that when movement is inputed, the character is instantly rotated to match world space flipping back to normal, breaking the connection between gravity and rotation, breaking the movement I wanted to make.

(sorry if this is a bad explanation!)

Here is the code

 if(inputDirection.magnitude > 0.1f)
 {
     //flatten y as we are not using that axis.
     Vector3 cameraForward = (myCamera.transform.forward);
     //Vector3 cameraForward = (myCamera.transform.TransformDirection(Vector3.forward));
     cameraForward.y = 0f;
     cameraForward.Normalize();
     Vector3 cameraRight = (myCamera.transform.right);
     //Vector3 cameraRight = (myCamera.transform.TransformDirection(Vector3.right));
     cameraRight.y = 0f;
     cameraRight.Normalize();

     Vector3 targetDirection = (cameraForward * moveInput.y + cameraRight * moveInput.x).normalized;

     if (targetDirection.magnitude > 0.1f)
     {
         Quaternion targetRotation = Quaternion.LookRotation(targetDirection);
         transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotationSpeed * Time.fixedDeltaTime);
     }
     //more to consider in the future! such as damping the Y value on speed. for now This is just a base.
     if (rb.velocity.magnitude > maxSpeedWalk)
     {
         rb.velocity = rb.velocity.normalized * maxSpeedWalk;
     }
     //end with moving forward from character perspective
     rb.AddForce(transform.forward * moveSpeed, ForceMode.Acceleration);
     //playerAni.SetBool("Moving", true);
 }

I know that the issue lies on the declaration of the camera’s reference and the calculation of said targetDirection, but I am not sure how I would go about fixing it, I have tried TransformDirection but it still doesnt work, would anyone have a suggestion as to what i can do?

Side note (The camera is a child of another empty object that gets rotated, so i am just tricking the camera into flipping around, not manually calculating a new orientation of the camera)

solved it myself after a couple of hours lol !
I just used ProjectOnPlane to get the normal and ensure that the transform.up always reflected the desired orientation’s transform.up, no more need for that camera.y and normalize business

                Vector3 cameraForward = Vector3.ProjectOnPlane(myCamera.transform.forward, myCameraOrientation.transform.up);
                Vector3 cameraRight = Vector3.ProjectOnPlane(myCamera.transform.right, myCameraOrientation.transform.up);