Skip to main content

Function: createXRBlocksEnvironment()

function createXRBlocksEnvironment(
scene: Scene,
context: XRBlocksEnvironmentContext,
options?: EnvironmentDirectorOptions & ThreeEnvironmentPortOptions
): XRBlocksEnvironmentSetup;

Defined in: xrblocks-environment/src/index.ts:75

Wire an environment director to an XR Blocks scene.

const { director } = createXRBlocksEnvironment(xb.core.scene, {
depth: xb.core.depth,
lighting: xb.core.lighting,
}, { presets: STOCK_PRESETS });

director.setPassthrough(true);
director.setOcclusion(DEFAULT_OCCLUSION);
director.setLightEstimation(true);
// then, from the XR Blocks script's own update:
director.update(deltaMs);

The director does not tick itself, and on this host that matters more than on the others: both sensors are polled from update.

Parameters

ParameterType
sceneScene
contextXRBlocksEnvironmentContext
optionsEnvironmentDirectorOptions & ThreeEnvironmentPortOptions

Returns

XRBlocksEnvironmentSetup