Use MapBox in playground

Hello everyone

I want to use MapBox and BabylonJS together in Playground, is it possible to do it?
this is my PG, but it has some errors, i want to know is it possible to use it in playground?

https://playground.babylonjs.com/#QGMGUY#2

You need a createScene function in your playground. See the default code of the default scene: https://playground.babylonjs.com/

1 Like

hi @Evgeni_Popov

I have createScene function in my PG,

Yes, sorry for that.

It is document.querySelector('body').appendChild(div); and not document.querySelector('body').appendChild('div'); as well as var url = "https://api.mapbox.com/mapbox-gl-js/v1.8.1/mapbox-gl-dev.js"; instead of var url = "'https://api.mapbox.com/mapbox-gl-js/v1.8.1/mapbox-gl-dev.js'";. Also, computeWorld and world don’t exist in your PG.

thank you so much, sorry for my mistake.

I deleted computeWorld and edited my code. but again I couldn’t see the map and the model.

https://playground.babylonjs.com/#QGMGUY#6

You are still using a world matrix that does not exist, see line 71.

Look at the browser console and make sure you don’t have any error there:
image

1 Like

Sorry for my many questions. :sweat_smile:

I think I solved the problems, but I don’t know I can’t see the map.
https://playground.babylonjs.com/#QGMGUY#7

i put mapbox api but on the console there is an error, is it possible to say me what is my problem?

It seems it is a duplicates of Is it possible to use MapBox inside babylonJS engine?, I think you should focus on the latter post.