3rd person camera that rotates around an object in 3D?

How would one go about creating a camera that both looks at and rotates around an object, such as the player character, in 3D? So for instance when you press left on the right stick or move the mouse to the left the camera rotates around the specified object horizontally while continue to looking at it, and likewise by pressing up or pushing the mouse upwards along the vertical axis. This is a common camera setup for 3rd person 3D games for decades now, but I’ll admit that I’m not seeing an obvious way to handle this.

The action put an object around another seemed promising for this initially, but that action was designed with 2D in mind and as a result does not help in getting the camera to orbit upwards or downwards around an object. This action could be useful for top down or isometric 3D games, but I suspect it’s not what I’m looking for at the moment.

I also tried creating a 3D box around the player character that would be set invisible once the scene starts as a sort of target for the camera, but without the ability to parent the box which the camera is looking through the eyes of to the target I’m back at square one. Getting the camera object to match the rotation of the target is useful, since that allows us to rotate the camera separately from the character’s action, but I don’t know how to take the next step to get the camera properly orbiting both horizontally and vertically.

Any ideas out there?

You could do it two ways:

  • use the Third person camera extension (the easiest way), or
  • use trigonometry to calculate the position around the target object, combined with the Look at an object (General/3D/Layers and cameras) or Look at a position (General/3D) actions.

Wow, do I ever feel like a doofus for spending so much time today trying to get that working on my own. I even had the extension installed! I went ahead and opened up an action now that I’ll start experimenting with tomorrow.

I was trying to do something like this, but I was piecing together ideas I saw in other threads that weren’t quite working. Trigonometry functions are about where my math studies started to take a nosedive I’m afraid.

Thanks for the suggestions, and pointing out that extension for me! Much appreciated.