currently I am creating a robot model in react. This robot model is in .glb format and I am using React Three fiber to paste every mesh object in to the scene (I got the names of the meshes from blender). Via zustand and my control function I can rotate some joints to move the robot in the direction of desire. My next goal is to “extract” each worldcoordinate of the joints and show them in my overlay close to the control buttons.
I already tried something like that:
<mesh
ref={joint_1}
onClick={(vectorEvent) => {
let vector = new THREE.Vector3();
vectorEvent.object.getWorldPosition(vector);
console.log(vector);
}}
></mesh>
but this only works when I click the joint I want the coordinate from. I want to do this with an onClick event on my control function(complete different function and not part of THREE nor GLTF) when I change some angles. Any Ideas?