threlte logo
@threlte/extras

<Billboard>

This component is a port of drei’s <Billboard> component which rotates its contents to always face the camera.

<script lang="ts">
  import { Canvas } from '@threlte/core'
  import Scene from './Scene.svelte'
</script>

<div>
  <Canvas>
    <Scene />
  </Canvas>
</div>

<style>
  div {
    height: 100%;
  }
</style>

Examples

Basic Example

Billboard.svelte
<script lang="ts">
  import { T } from '@threlte/core'
  import { Billboard } from '@threlte/extras'
</script>

<Billboard>
  <T.Mesh>
    <T.MeshStandardMaterial />
    <T.PlaneGeometry args={[2, 2]} />
  </T.Mesh>
</Billboard>

To disable the billboard from rotating its contents to face the camera, you can optionally pass in a follow prop set to false.

You can also optionally pass in a lockX, lockY, or lockZ prop to lock the rotation of the billboard on a specific axis.

BillboardLocked.svelte
<script lang="ts">
  import { T } from '@threlte/core'
  import { Billboard } from '@threlte/extras'
</script>

<Billboard lockX>
  <T.Mesh>
    <T.MeshStandardMaterial />
    <T.PlaneGeometry args={[2, 2]} />
  </T.Mesh>
</Billboard>

Component Signature

<Billboard> extends <T.Group> and supports all its props, slot props, bindings and events.

Props

name
type
required
default

follow
boolean
no
true

lockX
boolean
no
false

lockY
boolean
no
false

lockZ
boolean
no
false