Hi everyone,
I’m facing a coordinate synchronization issue during a heavy, scroll-driven Three.js animation managed via GSAP ScrollTrigger.
The Setup:
-
The Mesh: A single tree structure that scales and rotates upright from flat ground (rotateX(-90^\\circ) \\to rotateX(0^\\circ)).
-
The Flight: As the user scrolls, the camera/world moves deeply along the Z-axis (forward tunnel travel).
-
The Shadow: A custom light source projects the tree’s shadow onto a virtual back wall, causing the shadow edge to dynamically climb up along the Y-axis.
The Problem:
I am trying to project HTML DOM text overlays to perfectly track the moving 3D intersection point where the shadow climbs the Y-axis wall.
Using standard vector.project(camera) causes severe visual lag and positional drift. Because the mesh is simultaneously translating on the Z-axis, rotating on the X-axis, and the shadow is climbing on the Y-axis, the calculated 2D screen pixels stagger and misalign during fast scrolling.
Question:
What is the most performant way to lock 2D DOM elements to a moving 3D shadow intersection point on a vertical plane under aggressive scroll-bound matrix updates?
Should I use a continuous Raycaster loop from the mesh tip to the back wall to capture the true Vector3 before projecting, or is dropping DOM overlays for HTML5 Canvas/WebGL text textures the only lag-free solution here?
Thanks!