- Home /
First person controls and Portals
Hi, I'm using a modified first person controller. I've implemented basic portals. Which are triggers the player walks through one and appears out of another. However I want the player to emerge in the same direction that the portal faces. (I'm currently using cubes for the portals but probably will switch to planes). So I use the code player.transform.rotation = destinationPortal.transform.rotation; That works fine. However the FP controller capsule remains rotated. This is only an issue when the destination portal is at non zero x and z angles. I have the camera attached to the FP controller constrained in the Y axis(to mimic head and neck movement) so changing the rotation of the camera might not be ideal. I'm just wondering how do others handle this? I was thinking of just facing the player in the direction of the portal in just the Y axis but am having a little trouble affecting just one axis. Any thoughts? Thanks