Skip to content

TrackballControls does not support on-demand rendering like OrbitControls #30931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wuyifan0203 opened this issue Apr 15, 2025 · 0 comments
Open
Labels

Comments

@wuyifan0203
Copy link

Description

TrackballControls does not emit the change event on all interactions (such as mouse wheel zoom), which makes it incompatible with on-demand rendering patterns that work with OrbitControls.

This prevents expected render behavior in performance-sensitive applications.

Reproduction steps

  1. Set up a scene using TrackballControls.
  2. Attach a change event listener to trigger rendering.
  3. Interact with the scene using the mouse wheel to zoom.
  4. Observe that:
    • The change event is not fired.
    • Rendering does not update unless done in a loop.

Code

✅ Works as expected with OrbitControls:

const controls = new OrbitControls(camera, renderer.domElement);
controls.addEventListener('change', () => {
    tick();
});

function tick() {
    renderer.render(scene, camera);
}
tick();

This correctly triggers re-renders during user interaction.

❌ Broken behavior with TrackballControls:

const controls = new TrackballControls(camera, renderer.domElement);

controls.addEventListener('change', (e) => {
    console.log('change', e);
    tick();
});

controls.addEventListener('start', (e) => {
    console.log('start', e);
});

controls.addEventListener('end', (e) => {
    console.log('end', e);  
});

function tick() {
    renderer.render(scene, camera);
}
tick();

Steps:

  1. Scroll the mouse wheel to zoom.
  2. Console shows start, end but no change.
  3. Camera visually moves, but tick() is not triggered.
    Expected: start, change, end.

Live example

null

Screenshots

null

Version

r175

Device

Desktop

Browser

Chrome

OS

Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants