Hello, I am trying to develop a system that will switch the player from a space view of a planet to a surface view. The terrain is in a separate area of the level and there is going to be a camera hovering over it that will be switched to when the transition is made. I want the second camera over the flat terrain to match the rotation of the main camera relative to the angle of the nearest point on the surface of the planet sphere model to make the transition as cohesive as possible, but I have no idea how I would calculate that.
Can you share some pictures or diagrams of how the first and second camera looks, that will give better understanding of the problem statement
I have actually managed to solve the issue. I ended up continuously line tracing from the player to the center of the planet model to get the normal of the nearest point on the sphere’s surface, which is acting as the player’s ground plane. Then, I modified some code I found here: Rotation from normal ? - C++ Gameplay Programming - Unreal Engine Forums which calculates the angle of the sphere’s surface as an FRotator using the detected normal. The fake player’s rotation is set by subtracting the surface angle from the real player’s rotation. This allows the fake player and the real player to be rotated in the same way relative to their own ground planes so the perspective will be similar when the real player’s camera switches to the fake player’s camera. I included diagrams anyway to illustrate it better. Thank you for your interest!