Skip to content
← SelectLAB·07PT
LAB · 07 / 09

Robot by math

Watches the cursor and stacks the blocks you drop. No keyframes. inverse kinematics · springs · state machine

How it works

Visual mode: HDRI lighting, ambient occlusion, bloom, depth of field and quality that adapts to your device. Light mode: no post-processing, for phones, weak laptops and for studying the technique.

  1. 01

    State machine

    Wander, curious, grab, carry, stack, startled and sleep. Each state sets where the robot drives, where it looks and where the claw must reach.

  2. 02

    Inverse kinematics

    The arm has two segments. The law of cosines gives the elbow angle to reach the target; of the two solutions, the one keeping the elbow in front of the body wins.

    cos C = (l1² + l2² − d²) / (2·l1·l2)
  3. 03

    Springs

    Head, arm, claw and suspension follow their targets with critically damped springs, solved exactly every frame: fast, and never overshooting.

    x(t) = alvo + (x0 + (v0 + k·x0)·t)·e^(−k·t)
  4. 04

    No keyframes

    No canned animation: the tracks scroll with the distance driven, dust comes out in proportion to speed, the cables are Catmull-Rom curves rebuilt every frame between body and head, and the eyes blink at random intervals.

  5. 05

    Wear in the shader

    The paint lightens and chips only on the edges: the shader measures, in object space, when a point is close to two faces at once and breaks the edge with noise. The status LEDs show the state machine.