Sign in to follow this  
grire974

Incorrect BoundingInfo from SceneLoader

Recommended Posts

I think I've come across a bug with how SceneLoader handles positioning.  Not sure yet whether this is BJS 2.4, or the FBXExporter code that is being used to generate a .babylon file from the FBX that I exported from Blender.

When I load this file:

https://drive.google.com/open?id=0BzfS-gwTfPBtMFp1bzg5N1BLOWM

using BABYLON.SceneLoader.load()

I can't get the correct BoundingInfo for the lower equalizer bars (38_EQBars001); it provides the same bounding info as the upper equalizer bars (37_EQBars002).

e.g. 

for (i = 0; i < myScene.meshes.length; i++){
        myScene.meshes[i].refreshBoundingInfo();
        console.log("found mesh with min: id = "+myScene.meshes[i].id+", "+myScene.meshes[i].getBoundingInfo().minimum.y+", and max"+myScene.meshes[i].getBoundingInfo().maximum.y);
}

returns the same min and max Y values for both equalizer meshes; even though they display correctly (e.g. not the same positions).

If you analyze the JSON of the .babylon file; you'll notice the position values for both meshes are almost identical.  What is different is the rotation quaternion for both meshes - which makes sense because to create the 2nd set of equalizer bars, I cloned the first set and then rotated them into position; Thus my theory at this stage is that either the FBXConverter or BJS 2.4 aren't taking this into consideration.

I also read this forum:

However, using setTimeout in conjunction with refreshBoundingInfo() doesn't seem to have any positive effect.

The downside of this all is that I can't tangentially position this model next to anything else as I don't have correct bounding info. 

Any help would be much appreciated.

Share this post


Link to post
Share on other sites

Hi - Thanks for the reply (sorry to post in the bugs forum if this doesn't appear to be a bug).

Still having the same issue; I'd create a sandbox to illustrate this - however I don't see a way to add your own .babylon files to the sandbox..?  Any other thoughts?

Thanks.

Share this post


Link to post
Share on other sites

Thanks for the pointer.. In trying to demonstrate my problem - I think I figured it out; I was rotating my mesh 90 degrees around the x axis in order to bring it into line; boundingInfo seems to reflect the mesh's original bounds - rather than those after it has been rotated.

This is the playground I created:

http://www.babylonjs-playground.com/#27IOZS

The goal here is to dynamically load a mesh/babylon file (e.g. potentially any mesh from an unknown source); and then position said mesh such that it is tangental to the ground mesh.

I ran the for loop again after the rotation was made to see if that would update the boundingInfo - however it doesn't seem to.

Perhaps not a bug - still a little confusing I found; spent quite a lot of time scratching my head on this one.

Share this post


Link to post
Share on other sites

It is correctly positioned now...  However I'm positioning the height of the model based off of the min and max Z values returned from the boundingInfo.  My intuition was expecting to use the Y values - but eventually guessed that I had to use the Z values as the model had been rotated 90 degrees around the x axis.

The final question I guess is - should boundingInfo automatically represent all translations such as position and rotation (haven't tested for positional changes yet) made to a given mesh; or is it the developer's responsibility to keep track of their changes and apply further calculations to boundingInfo in order to get updated values.  Obviously I'd prefer the former - but thought I'd raise the question none the less...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.