Controlling Orbit Behavior & Refreshing Shadows in CameraController

Hi everyone,

I’m using the CameraController extensions in Speckle, and I need the orbit control functionality. While it works, I’ve noticed an issue when clicking and zooming—it always sets the orbit center at the closest intersection point, even if that point belongs to a hidden object. This is problematic because my scene contains hidden geometries that interfere with navigation.

Desired Behavior:
I’d like the orbit center to be determined by the first intersection with a visible object, ignoring hidden ones. Is there a way to control this?

I’ve tried disabling orbitAroundCursor, but this results in an awkward orbiting experience where the cursor position is ignored entirely. I know that double-clicking a visible object correctly sets it as the orbit center, but as soon as I drag, the logic resets and picks the first intersection again—including hidden objects.

async function initialiseViewer() {
    if (!container.current) return;
    /** Configure the viewer params */
    const params = DefaultViewerParams;
    params.showStats = false;
    params.verbose = true;
    /** Create Viewer instance */
    const viewer = new Viewer(container.current, params);
    await viewer.init();
    const cameraController = viewer.createExtension(CameraController);
    }

Additionally, I’m facing another issue: after hiding geometries, the shadows cast onto the invisible base plane don’t seem to refresh properly. Is there a way to force a shadow update?

  useEffect(() => {
    if (!speckleViewer) return;
    const renderer = speckleViewer.getRenderer();

    if (isolatedObjects.length == 0) hideUncheckedGeometries();
    renderer.shadowMapNeedsUpdate = true;
    renderer.updateShadowCatcher();
    speckleViewer.requestRender(UpdateFlags.RENDER_RESET | UpdateFlags.SHADOWS);
  }, [geometryGroups, isolatedObjects]);

Would appreciate any insights—thanks in advance!

Hi @NaoB

There is no option to enable this yet. However the general use case for ignoring hidden objects is very valid. That’s why we decided to make this the default. You can get this update in the next release which should be happening later this week.

This was actually a bug on our side. Calling updateShadowcatcher should be enough to trigger a shadowcather update. This will also be fixed in this week’s release

Let us know if you need more help

Cheers

1 Like

got it, thanks for the fast response! looking forward to the next release

Hi @NaoB

We’ve just release version 2.23.12 which has fixes for both of your raised issues

Cheers

Amazing! it works perfectly now. Thank you!

1 Like