but I get the console message: ‘Uncaught (in promise) TypeError: dummy.position is not a function’.
I am unsure how to get the code to read the json file and set the latitude and longitude of each marker based on these coordinates, any advice would be appreciated.
here is a link to an editable version of my code: Glitch :・゚✧
This is a pretty straight explanation. .position is a property of Vector3.
If you want to set values to it, use .set() or .copy() (those methods of Vector3), thus, dummy.position.set( x, y, z ); or dummy.position.copy( vector3 );
Could you answer, for yourself in the first place, what are you doing with lines:
for (let i = 0; i < markerCount; i++) {
fetch('./country_codes.json').then(r => r.json()).then(countryLocations => {
dummy.position(countryLocations);
});
dummy.position.set( 0.6, 1, 0.5 );
...
}
Inside of the for-loop you fetch locations (possibly, of lat and lon, and it’s in an array), setting position with the wrong syntax, then re-setting the position with constant values. Any explanation for that?
yeah haha didnt realise that until I tried out the code in codepen on your original model which was transparent, anyway its fixed now, all I had to do was use setFromSphericalCoords: dummy.position.setFromSphericalCoords( rad,1.2,0);