I’m working on a 3D file-and-data manager that’s opensourced under the CC-By license, which allows for modifications and commercial usage.
However, i’ve run into a snag… When displaying sub-folders (i thought it would be best to start it off with a file tree structure display), Sub-folders from different folders in folder ABC can overlap with each other, which is unwanted behavior.
So i built an overlap check routine, which adjusts the z-index of such occurrences.
However, the 2nd and possibly 3rd or 4th update of the z-index is simply not obeyed by threejs.
My source code is listed at nicerapp_v2/na3D.source.js at c3620e4f05cfdd378694870aee750a2507688f05 · nicerapp/nicerapp_v2 · GitHub and a live demo is listed at 3D file manager on nicer.app
The ‘ricepaddy’ debugger statement hits twice, the model.position for it is updated twice, but when you hover with the mouse over that item, it shows you that the z-index is only updated for checkCounter===1…
If you have any idea what could be the cause of this, i’d be very thankful to hear it…
I managed to get it working, sort of…
it’s the check for .model.position.x===0 that does the trick, apparently.
however, when i tried that, all of my coordinates were severely off their mark, sub folder items were spread out all over the page and into the depths of the z-axis as well.
i’ll keep at it, but if you happen to know what beginner’s mistake i’m making here, i’m very interested to learn what it might be.
(1) Please keep in mind that as much as we’d like to help - going through 1000+ lines of code isn’t really possible. It’s easier if you could replicate the issue with a minimal example on codepen or jsfiddle.
model.position is a local position (ie. within a parent.) For a submesh, it tells the position of that submesh within the parent model - not on the scene. And these can be significantly different values.
If you need a world position of a model, consider using Object3D.getWorldPosition.
(1) i managed to get it to work properly now… (demo at 3D file manager on nicer.app)
next time, i’ll try to duplicate my problem at jsfiddle…
(2) ok, thanks for the tips there…