Problem understanding clock.getDelta()
in useFrame()
(Beginner Question)
#1991
-
I'm having trouble using Relevant documentation: Excerpt from my sandbox example: useFrame(({ clock }) => {
const dt = clock.getDelta();
// 1000 ms / 60 FPS = 16.6 ms, so shouldn't this log a number
// around 0.017? It logs 0 or 0.001 every time.
console.log(dt);
}); Thanks so much for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
useFrame((state, delta) => {
... calling state.clock.getDelta() flushes the clock back to 0, that is how THREE.Clock works. this would not be scalable if you have multiple components. this is why useFrame gives you a delta which is valid for the current frame and accessible by all components. |
Beta Was this translation helpful? Give feedback.
calling state.clock.getDelta() flushes the clock back to 0, that is how THREE.Clock works. this would not be scalable if you have multiple components. this is why useFrame gives you a delta which is valid for the current frame and accessible by all components.