Can someone help me with react three fiber?

I’m trying to rotate a plane using quaternions around an earth but when I update the quaternion using usestate and useframe, the plane location doesn’t change.

i think this is quite unrelated to react, a quaternion is what it is. could you post code?

btw, why not simply wrap the plane into a group and rotate the group, isn’t that easier?




I’m moving my plane using quaternion values and I added state so I can change the coordinates. The plane moves just fine with the initial coordinates but when I change the coordinates using useState, the state changes but the plane movement stays the same.

screenshots are probably not the best, a real snippet or better a codesandbox would help. from what i can see it looks huge just to rotate a sphere. all these refs, for what? flightFromRef, flightToRef, that doesn’t look so good tbh.

there seem to be side effects and odd patterns. you cannot have any “new” inside render, you cannot call functions except hooks, you don’t use “if ref.current” conditions to execute code. if you have local state, that’s useState, if you have side effects that change the model, useLayoutEffect.

Temporary website link: https://venerable-lolly-e7cdcc.netlify.app/

Code link(Sphere.js):https://github.com/jacknimmble6/three-js-airport-simulation/blob/999f5d671ca34e7b2c2d123478b1610d5341ccf4/src/Sphere.js