threlte logo
@threlte/core

<SceneGraphObject>

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. It’s an advanced feature and you should only use it if you know what you’re doing.

This component is extending the component <HierarchicalObject> and conveniently provides methods to add and remove children to the scene graph.

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
<script>
  import { SceneGraphObject } from '@threlte/core'
  import { Mesh } from 'three'

  const mesh = new Mesh()
</script>

<SceneGraphObject object={mesh} />

Component Signature

Props

name
type
required

object
THREE.Object3D
yes