Tresjs / tres

Declarative ThreeJS using Vue Components
https://tresjs.org
MIT License
2.17k stars 102 forks source link

`Camera` wrapped by `TresGroup` cannot be used properly after `version 4.0` #727

Open hexianWeb opened 3 months ago

hexianWeb commented 3 months ago

Describe the bug

I tried writing this code in tresjs v 4.0.2

    <TresPerspectiveCamera :position="[5, 5, 5]" />
    <OrbitControls />
    <TresAmbientLight :intensity="0.5" color="red" />
    <TresMesh ref="boxRef" :position="[0, 2, 0]">
      <TresBoxGeometry :args="[1, 1, 1]" />
      <TresMeshNormalMaterial />
    </TresMesh>
    <TresDirectionalLight :position="[0, 2, 4]" :intensity="1" cast-shadow />
    <TresAxesHelper />
    <TresGridHelper :args="[10, 10, 0x444444, 'teal']" />
  </TresGroup>

Then I got this Snipaste_2024-06-07_19-14-08

However, it can run correctly in v3.9.0 Snipaste_2024-06-07_19-15-29

Reproduction

https://stackblitz.com/~/github.com/hexianWeb/starter

Steps to reproduce

No response

System Info

No response

Used Package Manager

pnpm

Code of Conduct

alvarosabu commented 3 months ago

Hi @hexianWeb thanks for reporting this, what would be the use-case of adding a camera to a group?

hexianWeb commented 3 months ago

Sorry for the late reply, I know adding a camera to a group is a weird operation. But I think it should probably have a more obvious error message (for example: can't wrap camera by group.) and why it works normally in v3.9.0, but doesn't work after v4.0.