Hi, I’m currently making a hanger with Id card.
Basically I’m following Vercel’s Id card implementation
While trying to make it responsive, I’m facing that physics world won’t update even re-render occurs.
It seems that Physics World gets cached and doesn’t affected by react state update.
Any advise on this?
On the video, you can see that Band(created with meshline and geometric position set by CatmullRomCurve3
) doesn’t gets updated when resize happens since catmull-rom spline data position is determined by RigidBody
from react-three-rapier
. This is why I’m arguing that physics world isn’t affected by state update.
Btw, following function gets executed when resize gets dispatched.
function resize() {
const w = clamp(window.innerWidth, 1020, 1980);
const h = window.innerHeight;
(camera as PerspectiveCamera).aspect = w / h;
camera.updateProjectionMatrix();
gl.setPixelRatio(window.devicePixelRatio);
gl.setSize(w, h);
updateDimension(); // zustand state
invalidate();
}
Additionally, ofcourse, IdCard properly subscribes on state properly.