I’m using a GLTF for the first time, and something weird is happening:
I’m trying to create an interactive data viz where you can see how many calories, etc are in your burger/sandwich as you add or remove parts of the sandwich. When you choose to add/remove a part, I need to recalculate the y for for the stack of sandwich parts you’ve chosen so you don’t, for ex, end up w big blank spaces in your sandwich if you remove several toppings. This should be pretty straightforward: loop through the stack of chosen sandwich parts, with y = the y of the last part + the last part’s height.
When I first tried it, the parts ended up all over the place. So, I used the inspector to move the parts to where they should be if all the parts had been chosen, then stored each part’s y in an array called list:
var list = [-0.15, -0.19, -0.24, -0.385, -0.514, -0.424, -0.454, -0.237, -0.286];
The y’s should get bigger. And yet first they get smaller, then the last few get bigger. ???
As a sanity check, I positioned the top bun at y=0, then created two spheres at y=0 and y=0.5.
I re-read the docs and googled gltf and position, and couldn’t figure out what’s going wrong. For ex, I wondered if the meshes were using local rather than world axes, but the doc says:
Position places the pilot with reference to the world axes using a vector (x, y, z)
Any idea what’s going on?
Also, if it turns out there’s an issue with the gltf/glb, which I found on remix, what’s the easiest free tool to look at & tweak it?