yomotsu / camera-controls

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features.
https://yomotsu.github.io/camera-controls/
MIT License
1.89k stars 241 forks source link

Not update in worker #490

Closed RyugaRyuzaki closed 3 months ago

RyugaRyuzaki commented 3 months ago

Describe the bug

I tried with worker, it did't update in worker

To Reproduce

        ( function anim() {

            const delta = clock.getDelta();
            // const elapsed = clock.getElapsedTime();
            const updated = cameraControls.update( delta );

            // if ( elapsed > 30 ) return;

            requestAnimationFrame( anim );

            if ( updated ) {

                renderer.render( scene, camera );
                self.postMessage( 'rendered' );

            }

        } )();

Code

No response

Live example

No response

Expected behavior

Runs stably on worker

Screenshots or Video

No response

Device

Desktop

OS

No response

Browser

Chrome

yomotsu commented 3 months ago

How do I reproduce that? Can you please elaborate on your problem, with a SIMPLIFIED demo using Codesandbox or so?

RyugaRyuzaki commented 3 months ago

How do I reproduce that? Can you please elaborate on your problem, with a SIMPLIFIED demo using Codesandbox or so?

Hi, i ran in example here :https://github.com/yomotsu/camera-controls/blob/dev/examples/worker.html . It did't work

yomotsu commented 3 months ago

It works on my devices. Can you please double check your setup?

RyugaRyuzaki commented 3 months ago

It works on my devices. Can you please double check your setup?

Well, i cloned the repo and run, not any change. so i referenced this :https://github.com/pmndrs/react-three-offscreen/blob/main/src/render.ts and it works

yomotsu commented 3 months ago

Sorry but without being able to reproduce the problem in my environment, I can't investigate the cause...