I want to do something conditionally based on the player being zoomed to the maximum out (I have CameraMaxZoomDistance
set to 18).
Right now, I have this line:
if (camera.CoordinateFrame.p - character.Head.Position).magnitude > 17 then
This works normally (more or less). However, it doesn't work if there's some object in the way of the camera. Since ROBLOX bumps the camera in so that you can't see through objects, the distance reported by this calculation is much less than the "natural" or "extended" camera distance which it will grow to in open space.
Is there any way to guess / calculuate that full distance or other workaround to estimate it?
It would also be nice since every few frames it seems like there can be a bit of delay and the camera will be reported slightly closer or farther than the range it's supposed to be (even in open space)
Well, the only method I can think of is using the WheelBackward and WheelForward to record how far or close the camera will move from the Character's head. That way, even if an object is in the way, you'll know how far the camera will be from the Head if that object wasn't there.
However, I do want to note that the Change in camera distance isn't linear, but exponential, so you'll have to do some math along with the programming.