-
hello all, i am making a game using r3f. the game is a strategy game so the game components will be resting for a majority of the time, and only moving position occasionally so i am using a demand frameloop to avoid needless re-renders. react spring has worked perfectly with a demand frameloop (using version 9.2.1) for animating positions of game components. but... i have some gltf animations that do not require changing props like position, rotation, etc. so i have been trying to figure out the best way to invalidate frameloops while the gltf animation is running (let's say the gltf animation is triggered by an event like a click). but right after the animation is finished, i'd like the frameloop to go back to rendering only on demand. somehow drei controls and react spring have figured this out but i'm a bit confused on how to implement their invalidation methods. any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
r3f exposes |
Beta Was this translation helpful? Give feedback.
-
ok, that wasn't so hard: https://codesandbox.io/s/gltf-animations-forked-dcwov?file=/src/Model.js useFrame(() => action.isRunning() && invalidate()) |
Beta Was this translation helpful? Give feedback.
ok, that wasn't so hard: https://codesandbox.io/s/gltf-animations-forked-dcwov?file=/src/Model.js