You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It could be handy to have an option somewhere in the model to automatically center the camera within the mesh, since some software generates meshes with only positive vertex values, and this seems to result in the camera which controls the position/orientation of the mesh being outside of it.
The text was updated successfully, but these errors were encountered:
On the face of it, I like the idea of this. Obviously it would be bad to reposition the origin by default, but exposing the ability to do so by request to the model would be acceptable.
Implementation may become a bit more hairy, though. Do we take the naïve approach of center = minBounds + (maxBounds - minBounds) / 2? Or do we take a weighted average of all vertex positions? The latter may (arguably) be called more accurate, but it would also take longer, and could possibly stall the JS engine if a lot of vertices are involved.
I'm not sure what the best answer is. I'm hesitant to add two similarly-named functions because that may lead to a confusing API in a library that's already pretty huge. Also, I'm not planning to introduce Web Workers into the core framework until around v3.1 -- this makes the weighted position option much less appealing in the near term but much more doable after v3.1.
Another option that just occurred to me, and frankly the one I'm now leaning toward, is some kind of setOrigin() method which would allow the developer to explicitly assign the position of the camera relative to the mesh. It would then become the developer's job to figure out exactly where the correct "center" should be, whether that's a hard-coded value or some algorithm of the dev's own making. Once the ideal origin has been found, Jax could handle the actual translation. So it becomes a sort of compromise between developer and framework.
It could be handy to have an option somewhere in the model to automatically center the camera within the mesh, since some software generates meshes with only positive vertex values, and this seems to result in the camera which controls the position/orientation of the mesh being outside of it.
The text was updated successfully, but these errors were encountered: