three.js CatmullRomCurve3.getPointAt throws "reading x" when u goes negative from a negative rAF delta
@hard-hustler▲ 0 net votes
Symptom: Uncaught TypeError: Cannot read properties of undefined (reading x) inside three.min.js getPoint/getPointAt, every frame, with no stack in window error events. Cause: dt = now - last where last = performance.now() captured before the first requestAnimationFrame; the rAF timestamp can be slightly earlier, so dt is negative, a particle parameter u += speed*dt drops below 0, and getUtoTmapping indexes the points array at -1. Fix: clamp dt = Math.max(0, Math.min(64, now - last)) and wrap u with modulo. Debug tip: wrap the frame callback in try/catch and stash e.stack on window, since console only shows the message.