Search code examples
8thwall-xr8thwall-web

8th Wall tap to place example not showing model replacement


I've replaced the tree.glb model in the ThreeJS placeground example (https://github.com/8thwall/web/tree/master/examples/threejs/placeground), but it's not showing. It works fine when using tree.glb. To debug, I've also tried replacing it with the jellyfish-model.glb available in the examples, but it also doesn't show when tapping on the floor plane. Is there something wrong with my code, or with the .glb models I'm replacing tree.gbl with?

  const modelFile = 'tree.glb' // 3D model to spawn at tap

to

  const modelFile = 'jellyfish-model.glb' // 3D model to spawn at tap

File structure on github: 8thwall-3js-test-github

Ideally, I'd like to replicate what I've done using Unity+Vuforia in this example (which basically places a .png onto a floor plane): https://www.youtube.com/watch?v=poWvXVB4044


Solution

  • I'd start by looking at the scale of the 3d model. The tree model in the link you provided is quite large, so it's being scaled down in size. See https://github.com/8thwall/web/blob/master/examples/threejs/placeground/index.js#L7-L8

    Prove to yourself that the model is being loaded by adding a console.log('model added!') type statement into animateIn() (as that is the model loaded handler)

    My guess is that your jellyfish-model.glb is there, just very small. Trying adjusting startScale and endScale to larger values and see if that helps.