Hello!!!
when turning left or right on the arrows, the object remains in place, although it should turn along with the camera.
What did I miss?
In Safari, Firefox, Chrome and Opera (all on macOS) the yellow sphere rotates along with the black ground plane. I don’t see a problem.
sphere.position.set(
camera.position.x - 5 * Math.sin(camera.rotation.y),
camera.position.y - 0.5 ,
camera.position.z + 5 * Math.cos(camera.rotation.y)
);
this will rotate the sphere with the cam and keep it at distance 5 from it.
Your formula was not polar coordinate system rotation.