Tresjs / tres

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

v-for of meshes doesn't add new instances to scene #284

Closed alvarosabu closed 1 year ago

alvarosabu commented 1 year ago

Describe the bug

 <TresMesh
      v-for="(player, key) in players"
      :key="key"
      :scale="1"
      cast-shadow
      :position="[player.x, player.y, player.z]"
    >
      <TresBoxGeometry :args="[1, 1, 1]" />
      <TresMeshNormalMaterial />
    </TresMesh>

If players increase size (new player) is not being added to the scene

Reproduction

https://stackblitz.com/edit/node-7ddska?file=src%2Fviews%2FHomeView.vue

Steps to reproduce

Hit key "R", you will see the list on top increase but not the amount of boxes

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (2) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
  npmPackages:
    @tresjs/cientos: ^2.0.0 => 2.0.0 
    @tresjs/core: ^2.0.0 => 2.0.0 


### Used Package Manager

npm

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/Tresjs/tres/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/Tresjs/tres/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://tresjs.org/guide).
- [X] Check that there isn't [already an issue](https://github.com/tresjs/tres/issues) that reports the same bug to avoid creating a duplicate.
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Sea-DH1 commented 1 year ago

`<TresMesh v-for="object in props.meshesInfo" :key="object.id" :position="object.position" v-bind="object.mesh" @click="testClick"

`

In this way, only one can be added