Hi,
I've loaded an 3ds model in my game, ive tested the bike.3ds from jME tests and i have noticed thet this model has MANY boundingBoxes. Is there a way to do only 1 bounding box for the model?
Err… I don't know exactly what you mean by this, but maybe this will help: Each node in the hierarchy of the scene graph will have its own bounds, and if you update them (with updateModelBounds) you will guarantee that each bound completely includes all the bounds of children nodes, and so forth. What you might want is to get the bounding volume of the most general node in your model.
I've loaded an 3ds model in my game, ive tested the bike.3ds from jME tests and i have noticed thet this model has MANY boundingBoxes.
Unknowingly I developed the same problem and this caused various problems during development of line of sight and other features. Check to see your code for importing bike.3ds that you are not creating the bounding on the .3ds file(e.g. the model node in FlagRush) - instead you are creating the bounding on the player node which you may attach the model node which contains bike.3ds.
each mesh (TriangleBatch) has its own bounding box. the reason y u c many bounding boxes is because that model is not one mesh but several combined.
this is good because it enhances culling speed.
if u want to retrieve the top level bounding, simply call getWorldBound() on the node of the trimesh object.
each mesh (TriangleBatch) has its own bounding box. the reason y u c many bounding boxes is because that model is not one mesh but several combined.
Ok forgive my ignorance here as I dont have that much experience with 3D models but as I understand that depending on the complexity of the model, they are general composed of few small meshes e.g. the model I used of a robot was composed of 3 objects(which I assume would be 3 individual meshes). When they are created in 3DS MAX or Maya then is the bounding put there or it is applied by jME when they are imported? Also what is the advantage of applying boundings at that level and would it not be good to just apply them to the model as a whole to implement the required functionalities?
Yes, the bounding boxes are applied by the code you write in JME.
As far as I can see, the advantage of multiple smaller boundingboxes is granularity… For instance, if I have a model of a chair, and I draw a big box around it, and then throw a ball at it, the ball could fly over both arms of the chair and not even hit it, yet it would still enter the big box I drew around the whole chair. There may be other advantages that I'm not aware of as well, I'm pretty new to this myself.
the advantage of multiple smaller boundingboxes is granularity.
A very fair point indeed! Good going! :lol:
As far as the main topic of the post goes, I think the user was alarmed to see "MANY" bounding boxes instead of one so it can be safely assumed he was not going for granularity :P
Could have and option to remove the bounding. If i put null on the ModelBound is it removed?
Just dont create it! e.g. dont use the following line when importing bike.3ds
model.setModelBound(new BoundingBox());
If you still dont understand it, post the code. On this note, have you been through HelloTutorials before using flagrush? They are really good and helped me a lot.
No, no, don't do this as it will create many unexpected results, as objects suddenly disappearing in your scene, even if they are in sight.
Why not use
Debugger.drawBounds(bikeNode, display.getRenderer(), false);
in the render method
This way the boundingboxes are still there but you only see the biggest.
What i want is to minimize the calculation to the bounding boxes. I need only one that cover all the model mesh.
have you tried Node.updateWorldBounds() on the parent node?
That is supposed to collapse all the BBs into one.
Humm… ive tried this and it works.
Besides i call updateModelBound() i called updateWorldBound and it put just one BoundingBox. The box does not cover all the model but it covers most part of it.
Thanks for the help.
I have learned much from all of your posts.