I have a character that’s located on the left side of the screen. I want the camera to constantly focus in on this character, so regardless of zoom value, the character will always be centered. At the moment when I zoom, it becomes awkward and offset
The second argument of CFrame is lookAt, which is the Vector3 position the CFrame will be facing to. CharacterRootPart is just an example name, you can make the CFrame look at the red part instead.
I’ve tried this and the issue is that’ll centre the character in the camera. Half the screen is occupied by UI tho. I need a way so the camera only takes into account the portion of screen that isn’t being occupied by UI
I think with this method you’ll have to find the sweet spot so the character will stay in the center of the portion of the screen. You can try making a CFrame that is facing the position of the character and changing its position based on the zoom level. Then take only the CFrame’s position and apply it to the camera.
Trying this, but 1. it seems to severaly distort the image for some reason and 2. I can’t figure out what size and position should be. If it’s supposed to be the size of the area on the screen, then I’ve tried that, but no use
Because you resized the X down to 45% but left Y at 100% so of course it looks squashed because that’s exactly what you asked it to do. If you wanted it to keep the aspect ratio then you need X and Y scale to be the same, like UDim2.fromScale(0.45, 0.45).
Not sure where else to post this, but I recently came across the resize module you’re using, and everything works fine except for the fact that it breaks on smaller screens. No idea how to fix this.
(SunRays also break, but that I can live without.)
EDIT: Setting Camera.FieldOfViewMode to MaxAxis and adding this line to Module._getOffset() seems to fix this for the most part:
x = math.clamp(x, -0.663, 0.663)
Note that using MaxAxis can result in unwanted changes to the FieldOfView if the user is able to resize their screen, so it’s best to reset it when the module is disabled.
(Set Camera.FieldOfView back to 70 and Camera.FieldOfViewMode back to Vertical)