A 3-revolute-joint planar arm. Forward kinematics chains rotation+translation per link; a damped-least-squares Jacobian solver drives the joints toward a draggable target and orientation.
How it works ▾
Forward kinematics: each of the 3 joints rotates the rest of the chain about its own pivot. The cumulative angle θcum,i = θ₁+…+θᵢ places joint i+1 at
p_i = p_{i-1} + L_i·[cos θ_cum,i, sin θ_cum,i]
and the end effector's orientation is simply φ = θ₁+θ₂+θ₃ (all joints are coplanar revolutes).
Inverse kinematics (Jacobian): every frame the 3×3 Jacobian J is rebuilt from each joint's pivot pi and the end point pend:
J[:,i] = [-(p_end.y − p_i.y), (p_end.x − p_i.x), 1]
Given the 3-D pose error e (Δx, Δy, Δφ), a damped least-squares pseudo-inverse solves
Δθ = Jᵀ(JJᵀ + λ²I)⁻¹ e
and the joints step toward the target every frame — a real gradient-based IK solver, not a canned animation.
- If the target is farther than the arm's total reach, it stretches toward it but never quite arrives — watch the distance readout stay non-zero.
- Near full extension the Jacobian becomes near-singular (det(J) → 0): the same pose error demands huge joint velocities, so motion gets jerky and the HUD warns you.