Trouble loading a different 3D object in the Tree example project - three.js: Place Ground

Hello,
I have a problem with the example project of the Tree animation placement, if you guys can help.
All im trying to do is to load a different 3D Object instead of the trees.
In the projects code, inside the place-ground-scene-module.js file,
in line 7, i changed the file path to the object i loaded through the bundle : const modelFile = require(‘./assets/concrete002.gltf’)

the first error it pops out in the console is:
TypeError: Cannot read properties of undefined (reading ‘children’)

I saw that the GLTFLoader constructor is non-defined, and that’s an error that was also before with the tree object. so i tried to use it’s parent class constructor.
Instead of writing:
const loader = new GLTFLoader()
i wrote:
const loader = new THREE.GLTFLoader()

then it shoots out an error:
Uncaught TypeError: THREE.GLTFLoader is not a constructor

any idea what’s the problem here? you can accesses the project and the files through the quickstart
thanks for any help

I would try converting your glTF model to GLB.

If your model is exported as a glTF, drag and drop the glTF folder into gltf.report and click Export to convert it to a GLB.

I also tried a glb model. Exported from blender as glb and as gltf. Didn’t work

I would replace lines 53-60 with this

  const animateIn = (model, pointX, pointZ, yDegrees) => {
    const scale = {...startScale}

    model.scene.rotation.set(0.0, yDegrees, 0.0)
    model.scene.position.set(pointX, 0.0, pointZ)
    model.scene.scale.set(scale.x, scale.y, scale.z)

    // Set castShadow on the first child of the scene, if it exists
    if (model.scene.children.length > 0 && model.scene.children[0]) {
      model.scene.children[0].castShadow = true
    } else {
      console.error('No children found in the model to cast shadow.')
    }

    XR8.Threejs.xrScene().scene.add(model.scene)

Then make sure your 3D models are nested like so

Screenshot 2024-04-10 at 11.07.23 AM

Hey man, sorry for the late reply
your code solved it! thank you very much
the problem was it was trying to access and arbitrary model and not a scene specific object?