Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access single vertices of mesh loaded with GLTFLoader in Three.js

I am loading a glb-File using GLTFLoader in Three.js: Before I was using the JSONLoader. Accessing the vertices of the loaded mesh was easy:

meh.geometry.vertices

But when looking at the mesh loaded with GLTFloader, I just can not find, where the vertices are?

I need to manipulate each single vertex for some particle animation.

Thanks

like image 345
Paul Hoepner Avatar asked Jan 01 '26 21:01

Paul Hoepner


1 Answers

Use console.log(gltf)- To view the JSON file, then you will find everything in Scenes. To access the mesh use gltf.scene.traverse( function ( child ) {if ( child.isMesh ){ child.geometries.attributes...}}

like image 84
Maverick_sid Avatar answered Jan 03 '26 11:01

Maverick_sid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!