Formula to find an angle that can change.

Alex7710

New member
Joined
May 4, 2019
Messages
1
This is probably really simple but I can't get my head around it. I am making portals for college and need to set the players rotation to the angle they are looking in when they teleport. Since portals can be rotated from 0 to 360 in the yaw, the angle they are looking in is different to what they are seeing out. There are two examples, one with the portals facing opposite directions and one with a portal turned 90 degrees to the other.
I can get the angle X and Y by getting the objects' rotations, but since these values change I need to have the method to get Z as a formula. I've tried my best to draw it out for a visual.
Thanks for any help.Untitled.png
 
Top