Move camera to a point when angle, distance and initial point are given

Hello,

I have a gameobject in the ZX plane at world coordinates (215, 0, 80). I have a camera at world coordinates (67.5, 0, 80), at a distance of 147.5 units, pointing to the front of the gameobject. The gameobject will remain at its position but will rotate around all 3 axes during runtime. I need the camera to follow the front of the gameobject, revolving only in the ZX plane around it, staying at the same distance of 147.5 units always, according to the gameobject’s current y-axis rotation.

How do I calculate the required position and rotation of the camera for each current y-axis rotation of the gameobject?

Pretty simple; Grab the left vector of the gameObject, zero out the y-component, normalize, go to 147.5 away in that direction:

var left = targetObject.transform.left;
left.y = 0;
left.Normalize();

cameraTransform.position = targetObject.transform.position + (147.5f * left);

This will break if the target object at any point aims it’s left directly up. In those cases the left variable will hold a zero-length vector, and normalization is undefined. But in those cases, the answer to “where is 147.5 to the left of the gameObject on the xz plane” will also be undefined, so you’ll have to figure out what you want to happen in those cases if they show up.

Hi, I am new to all this, and this seems like a good question, so forgive me if I am not much help but have you tried to play with cinemachine for a while to try to find a preset that works for you?
I am also really interested in the answer because I will at one point need to tackle a problem with my camera. I got mine to follow and wobble the way I want but I will need 3 states of camera to change in correlation with move speed.