Skip to content

Latest commit

 

History

History
64 lines (54 loc) · 1.67 KB

billboard.mdx

File metadata and controls

64 lines (54 loc) · 1.67 KB
order category name sourcePath type componentSignature
7.12
@threlte/extras
<Billboard>
packages/extras/src/lib/components/Billboard/Billboard.svelte
component
extends props
name type default required
follow
boolean
true
false
name type default required
lockX
boolean
false
false
name type default required
lockY
boolean
false
false
name type default required
lockZ
boolean
false
false

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

Examples

Basic Example

<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.

<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>