The position of gltf model on Potree

Hello ,
I’m trying to rotate or scale the gltf model on the potree viewer but it doesn’t work what I expected despite the position is able to transfer properly.
When I rotate or scale, the gltf model seems to move vertically or horizontally like you move the position.

I suspect that the origin of the gltf model is at far away from the model itself like the solar system example in the three.js fundamental so when you rotate the model it seems that it is moving vertically. I’m not really sure about this though.

However, this gltf model seems to have a position information that can’t be able to see through console.
The image below shows that even the world matrix is in the origin despite the gltf model shows at the different.

I confirmed that it has the invisible position values because when I open the model by adobe dimension, the position info was there. I also modify and reset the model’s position to the origin and the rotation and scale was perfectly working.

this is the basic code when you add the gltf model to potree.

		var loader = new GLTFLoader().setPath( './' );
		loader.load( 'IronMan.glb', function ( gltf ) {

			console.log( 'gltf ', gltf.scene);

			gltf.scene.position.set(0, 0, 0);
                            // this rotation and scale doesn't work properly in this case.
			gltf.scene.rotation.set(Math.PI / 2, Math.PI, 0);
			gltf.scene.scale.set(0.1, 0.1, 0.1);

			viewer.scene.scene.add( gltf.scene );

			// Add this on JSTREE
			let tree = $(`#jstree_scene`);
			let parentNode = "other";
			let gltfID = tree.jstree('create_node', parentNode, {
						text: "Ironman",
						icon: `${Potree.resourcePath}/icons/sphere.svg`,
						data: gltf.scene
					"last", false, false);
			gltf.scene.visible = true;
			tree.jstree(gltf.scene.visible ? "check_node" : "uncheck_node", gltfID);
		} );

My purpose is to be able to rotate and scale the gltf model even those which has the hidden position or dependencies in the Potree. In order to this I’m looking for how to reset this hidden info by potree(or I should say Three.js). There is still possibility that this issue comes from Potree scene dependecies as well.

I’m very thankful to have this community.
Please give me any little idea if you have. I’m been working this for over a week.

Can you please verify whether the geometry of your model has an offset or not? If so, please try to center the geometry via

1 Like

It worksss!!! thank you so much @Mugen87 !!

Hi Hiroshi, I’m new to potree. I’m trying to load GLTF model to potree. It will be helpfull if you share sample code to load glft inside potree.

The first post of @Hiroshi already showed the code for this task.

Hi @Mugen87,

Thanks for your reply.
I worked with the above code. I’m getting an error of " Cannot read properties of undefined (reading ‘getUniforms’)"


Please demonstrate the issue with a complete code example. Ideally with a live example or by sharing your code with a GitHub repository.

Thanks, @Mugen87. Upgrading Potree from 1.6 to 1.8 the code worked.