@threlte/core
SceneGraphObject
This component is extending the component
<HierarchicalObject>
and conveniently provides methods to add and remove children to the scene graph.
INFO
This is a trait component. Trait components are mostly used internally and make certain aspects of three.js objects accessible and reactive and interact with Threlte systems.
Basic Example
In this example the component is responsible for
- forwarding the mesh to the parent
<HierarchicalObject>
- adding children to the scene graph, i.e. as children to the mesh
- removing children from the scene graph
TIP
You most likely want to use a
<MeshInstance>
component in this scenario. The component <SceneGraphObject>
is part of the component
<Object3DInstance>
, which the component <MeshInstance>
is extending.
<script>
import { SceneGraphObject } from '@threlte/core'
import { Mesh } from 'three'
const mesh = new Mesh()
</script>
<SceneGraphObject object={mesh} />
Properties
// required
object: Object3D