mattrei / aframe-mapbox-component

A Mapbox component for A-Frame
https://mattrei.github.io/aframe-mapbox-component/
MIT License
16 stars 5 forks source link

does not work with aframe 1.0.4 #8

Closed sehadnassim closed 3 years ago

sehadnassim commented 3 years ago

here is a glitch file : https://glitch.com/~seed-uncovered-phone as if you test examples/gps/index.html it works well with aframe 0.8.2 but the position on the map does not change with aframe 1.0.4

sehadnassim commented 3 years ago

image

mattrei commented 3 years ago

thanks, i will look at it this weekend.

sehadnassim commented 3 years ago

thanks, i will look at it this weekend.

Any updates on this ? Thanks

mattrei commented 3 years ago

hi, there was some change in the handling custom canvas material between 0.8 and 1.0.4 See here however the issue lacks of detailed descriptions. The official examples show that the canvas must be create in the a-assets container, however mapbox GL API creates automatically the canvas for you... so there could be the problem as well.

i am not sure why it does not update the canvas element, after calling needsUpdate=true on the Material... sorry for the moment, but i will investigate further a little bit later

kfarr commented 3 years ago
mattrei commented 3 years ago

thanks @kfarr for the investigation.

i don't think that the problem lies in the project function but rather in the update of the canvas material. it's just not refreshing the content of the canvas.

you can test this if you update the mapbox component attributes aftwards like setting the zoom or the center. the canvas just does not get refresehed and i have no idea why...

superma417 commented 3 years ago

@mattrei

By adding this component into a-mapbox, I could see the issue was fixed. But on oculus quest 2, it is displaying blank white plane. Can you check the reason?

AFRAME.registerComponent('canvas-updater', {
    dependencies: ['geometry', 'material'],

    tick: function () {
    const el = this.el;
    let material;

    material = el.getObject3D('mesh').material;
    if (!material.map) { return; }
        material.map.needsUpdate = true;
    }
});
mattrei commented 3 years ago

should be fixed with new version 4.0.1 . The material was updated to early for the canvas to be reflected. @superchao417 you do not need this canvas-updated anymore.