Adapt Orientation of player controls to camera?

Hi,

For my project, it involves my player character going through a series of rooms, sprawling in different directions. My problem is that as the player goes into room by room, the orientation of the player character stays the same, meaning that when he quickly gets to a room that not on the default angle, his forward could become a diagonal, in relation to the room, even through he is technically still going forward.

I have a camera that always adjusts itself so that the next room appears in the centre when a new one instantiates. I was wondering if it’s possible to change the orientation of my player character to correspond with the orientation of my camera object or if there is some other way to fix my controls. Any ideas?

If the door your character passes through is facing the right direction you can simply do

character.transform.forward = door.transform.forward

Failing that, you can find a vector from the door you go through to the middle door and set that as the forward vector for your character

character.transform.forward = Vector3.Normalize(middleDoor.transform.position - previousDoor.transform.position);

I’m assuming your floor layout is flat. Without knowing the code for controlling your character, its difficult to discern what would work for sure.

I don’t know if this is possible, as I’ve never tried to write something quite like what you have, but is it possible to tie controls to the camera directly - so as the camera shifts so many degrees, the controls shift the same?