Code Room
Vibe codingMediumvc-g354
Subject Ai code reviewLevel Mid–Senior~15 minCommon in Algorithms & data structures interviewsIndustries Computer games, Software development

Question

A Copilot-generated C++ camera-follow routine smooths toward the player each frame. QA reports that after a hitch — a one-second asset-streaming stall — the camera teleports across the level and clips through geometry. Review the smoothing code and explain the delta-time misuse that causes the teleport.

cpp
void Camera::Update(float dt) {    // exponential smoothing toward target    float t = smoothSpeed * dt;    position = position + (target - position) * t;    // also advance recoil offset    recoil += recoilVelocity * dt;    LookAt(player + recoil);}
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.