layers
layers is a plugin that provides inheritance for the property layers on <T> components.
Typically when assigning a value to layers on a <T> component, it will only be applied to that component.
This plugin allows you to assign a value to layers on a parent component and have it be inherited by all child components.
This plugin injects and relies on a context. It’s affecting all <T> components that are
descendants of the component that uses it. Check out the guide on structuring your
app to learn more about contexts.
<script> import { layers } from '@threlte/extras' layers()</script>
<!--The camera needs to be on the same layeras an object for the object to be visible--><T.PerspectiveCamera layers={[4, 5]} />
<!--Everything inside this group that isn'tassigned another layer is on layer 4 andis therefore visible to the camera--><T.Group layers={4}> <T.Mesh> <T.BoxGeometry /> <T.MeshStandardMaterial /> </T.Mesh>
<!-- This Mesh is on all layers --> <T.Mesh layers={'all'}> <T.BoxGeometry /> <T.MeshStandardMaterial /> </T.Mesh></T.Group>