Object in center, and the camera/player can rotate to view it in 360 degree

I want to put my object in center, and the player can view the object in 360 degree.
the player/camera should lock in that place, which they can only view the object and unable to view other places. just like the image shown, the player/camera is not allow to run to other place, how can i made it? thanks


create an empty object and place it in the same position as the target object. attach a script to it where in the update function you always move this empty object in the same position as the target object. note that you’d rather use this method than making the empty object a child of the target because you don’t want to rotate the empty object. then create a rotation script based on your inputs, let’s say, if you press ‘A’ rotate the empty object left, press ‘D’ - rotate right. then move the camera in the position where you want it to be initially. at last, make the camera a child of the empty object.