Skip to content
RED SAGSkills
mediumGame Developer interview question

How would you build a third-person camera that follows the player smoothly and does not clip through walls?

What the interviewer wants to hear

  • Orbit around a pivot near the character using yaw and pitch input
  • Smooth position and rotation with frame-rate independent damping
  • Sphere cast from pivot to desired position and pull the camera in on hits
  • Run in LateUpdate after the character moves
  • Handle edge cases: fading the character when too close, tuning values, Cinemachine

Model answer

I put a pivot at the character's shoulder or head height and orbit the camera around it with yaw and pitch from the look input, clamping pitch so it cannot flip. The desired position is pivot minus forward times distance. To avoid walls, I sphere cast from the pivot toward that position and, if it hits, move the camera to just before the hit point, pulling in fast and easing back out slowly so it does not pop. All of this runs in LateUpdate so the character has already moved, and smoothing uses exponential damping or SmoothDamp so it behaves the same at any frame rate. If the camera gets very close I fade the character out. In Unity I would often start from Cinemachine, which provides orbit and collider features already.

Can you answer it under time pressure?

Take a timed medium round and get scored on every answer.

Start mock interview

More medium Game Developer questions