How to make a camera orbit a planet and always look towards a player in the world while maintaining the player's forward vector at the top of the camera?

My current idea to use a camera attached to a spring arm, attached to the world, this maintains the correct position for the camera, but the rotation of the camera towards the player is wrong. If any one has a clue on how I could use an easier technique on getting a camera to orbit the cube planet (directly above the player), while the player is constantly moving, and to have the player’s forward vector pointing towards the top of the camera’s point of view, please do share.

I have tried placing a camera on the player, but then the world isn’t centered to the camera, unlike the photos below. By placing the camera behind the character, it does achieve the right rotation that is desired. I have also tried a free floating camera, unattached to either the planet or the character, and was able to achieve this by extending a vector from the center of the world (0,0,0) towards the player, and extended it further out till the radius of desired range of the camera. This worked the same as below, but it also ran into the same problem with camera rotation.

The answer depends on what is the most important for you. Setting it on the planet allows for always looking at the planet and you have to constantly update the position of the camera such that the planet location, player location and camera location are on a line. You can do this by getting a vector from the planet to the player, normalize and multiply it using a scalar value that is your radius. You also have to set the rotation like you are doing above.

The other option is to attach it to the pawn and add the offset rotation between the vector from the planet to the player and the current spring arm vector.

The former uses your code and allows for more customization of your camera location and rotation, but it will always focus the planet. The latter allows you to easily change focus around which you want to rotate or focus.

The code complexity is about the same.

Thanks, that gave me an idea to try. I think the solution is to simply remove the “Look at Rotation” and replace it with a different type of rotation update. The “Look at Rotation” equalizes the rotation to always have the up vector for the camera to be up, which should be the normal feature, but doesn’t work in my case. So this means that the spring arm wouldn’t be needed either, since the whole point of the spring arm was to give it a set length for the radius. I’ll retry to make a BP_Cam that gets its position by extending the vector from the world to the player to a set length like I tried before. Then find a new way to stabilize the rotation to look at the player, through to the world, to have the same view vector as the images above.

If any one has a clue on how to do the second portion about the angle stabilization, that would be nice.

@NoobsDeSroobs Thanks.