How to set camera position when CameraType = Orbital

Hi.
When a Character enters a room, I set the CameraType to Orbital.
I can set the camera distance from the player with this:
player.CameraMinZoomDistance = 50
player.CameraMaxZoomDistance = 50

But how do I set the position of the camera?
I found some old code that suggested that it may be defined using 3 dimensional Polar coordinates, but I’m not sure how to implement this.

Thanks!

Well, positioning the camera should be done when the camera is set to scriptable. If you want to do this, you will have to code a custom camera script, which isn’t too difficult. You just need to set the camera to scriptable, then set the camera’s subject to the HumanoidRootPart(To avoid bobbing). Then, simply set the CFrame of the camera to a desired location. Also, you should do this using RunService. You can’t just set the CFrame once, you need to update it constantly, and we cant use a while true do loop, because then it looks really choppy. So, yeah, update the CFrame using RunService. Rotating is a bit more difficult. You could possibly do this by either detecting the key that is pressed, using the characters LookVector, or a few other methods.

Thanks for the response.
But this doesn’t quite solve my issue.

I will clarify a bit.
I’m pretty happy of the camera behavior in the built-in CameraType = Orbital scripts.
But I want to set the position where the camera starts when I switch from CameraType = Custom to CameraType = Orbital.

Right now when I switch to CameraType = Orbital, the camera snaps to a seemingly arbitrary angular position, which differs depending on which way I’m facing. I’m able to define the distance from the Character, but I’m not sure how to define the angular position

This github page appears to show the code for handling the Orbital CameraType:

I want to inject an initial value for “cameraPosVector”, like they do in this code snippet:

			local cameraPosVector = curDistance * ( CFrame.fromEulerAnglesYXZ( -curElevationRad, curAzimuthRad, 0 ) * UNIT_Z ) 
				local camPos = subjectPosition + cameraPosVector

I’m almost positive you can’t script the camera unless the CameraType is Scriptable.

2 Likes