Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/camera/src/Client/CameraUtils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ end
--[=[
Fits a sphere to the camera, computing how far back to zoom the camera from
the center of the sphere.
Camera (C), object center (B) and a point in the bounding sphere (A) form a right angle triangle
A forms a 90 degree angle as any tangent to a circle is perpendicular to its radius. (This is hard to show in ascii).
AB is the radius and BC is the distance from the center to the camera (hypothenuse)
A
/ \
/ \
/ \
B----------C
Distance is given by equation sin(angle)=opposite/hypothenuse = sin(halfFov)=AB/BC => BC = AB/tan(halfFov)

@param radius number -- Radius of the sphere
@param fovDeg number -- Field of view in degrees (vertical)
Expand Down