threebox icon indicating copy to clipboard operation
threebox copied to clipboard

Changes needed to work with maplibre v5?

Open prusswan opened this issue 11 months ago • 4 comments

Threebox version: latest

Question

So I managed to get threebox to work with maplibre v4 (https://codepen.io/prusswan/pen/yyLBNgw - just a basic example with a sphere), but wanted to see if it can work with v5. Apparently there has been changes to how projection works since the globe view was added, but I think a simple fix should be possible since there are examples for threejs under maplibre-gl-js project. I managed to track down the section that needs changes at https://github.com/jscastro76/threebox/blob/40d4111ab426a4c0c3a52bb4de260f0232734b37/dist/threebox.js#L2086: transform object used to have a point attribute with xy, this attribute no longer exists in v5, I tried using map.transform.getMatrixForModel(modelOrigin, modelAltitude) described in the add-3d-model example to construct the world matrix, but while the errors are gone, the object cannot be seen on the map (so either it is placed at wrong location or there is something else that needs fixing too). Would appreciate if someone can point me in the right direction (or let me know if this is something that will take more than a simple fix)

prusswan avatar Feb 09 '25 00:02 prusswan

Have you solved it? I have modified some parameters of v5, but the position is incorrect. repo: huanglii/threelibre Image

huanglii avatar Feb 28 '25 08:02 huanglii

Have you solved it? I have modified some parameters of v5, but the position is incorrect. repo: huanglii/threelibre Image

Not yet.. but at least you managed to get something to display so that is good

prusswan avatar Feb 28 '25 08:02 prusswan

@huanglii did you delete the repository? I'm trying to implement something similar (not trying to handle the globe so far)

jacopofar avatar Jun 17 '25 12:06 jacopofar

@huanglii did you delete the repository? I'm trying to implement something similar (not trying to handle the globe so far)

It is now available(make it public). https://github.com/huanglii/threelibre

huanglii avatar Aug 19 '25 07:08 huanglii