You are reading Tres v1 docs. Head over tresjs.org for V2 docs.
Skip to content
On this page

Group ^1.5.0

A <TresGroup> is an instance of the THREE.Group class which is almost the same as a THREE.Object3D but allows you to group together multiple objects in the scene so that they can be manipulated as a single unit (transform, rotation, etc).

Loading...

Usage

vue
<script setup lang="ts">
const groupRef = ref()
const { onLoop } = useRenderLoop()

onLoop(() => {
  if (groupRef.value) {
    groupRef.value.rotation.y += 0.01
  }
})
</script>
<template>
  <TresGroup ref="groupRef" :position="[2,0,0]">
    <TresMesh>
      <TresBoxGeometry />
      <TresMeshBasicMaterial color="red" />
    </TresMesh>
    <TresMesh>
      <TresSphereGeometry />
      <TresMeshBasicMaterial color="blue" />
    </TresMesh>
  </TresGroup>
</template>