Skip to content

Documentation / @ripl/vue-3d / useRiplContext3D

Function: useRiplContext3D() ​

useRiplContext3D(): ShallowRef<Context3D | undefined>

Defined in: vue-3d/src/compositions/index.ts:35

Returns the 3D rendering context provided by the nearest <ripl-context-3d>.

This is useRiplContext() narrowed to Context3D, so the 3D surface — raycast, lights, setCamera, fog — is reachable without a cast.

Returns ​

ShallowRef<Context3D | undefined>

The 3D context, or undefined when there is none.

Example ​

ts
const context = useRiplContext3D();

const pick = (x: number, y: number) => context.value?.raycast(x, y);