Open
Description
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
- Set up a scene using
TrackballControls
. - Attach a
change
event listener to trigger rendering. - Interact with the scene using the mouse wheel to zoom.
- Observe that:
- The
change
event is not fired. - Rendering does not update unless done in a loop.
- The
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:
- Scroll the mouse wheel to zoom.
- Console
shows
start
, end but no change. - 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