Normalizing a model?

does jme support "normalizing" of a model (scale a model so that it's bounding box has a size of <=1 at each side)? i did it in previous games and it was quite useful because i could simply assign any model a size and didn't have to worry about the models original size

since a model is loaded to jme as a spatial or a node (node extends spatial), u can set a scale to the model, which should do the same thing as u described above

no, it doesn't. i don't want to scale it, i want to tell it what size to have.

HamsterofDeath said:

no, it doesn't. i don't want to scale it, i want to tell it what size to have.


Scaling is the same as telling what size to have ;) Still don't understand what this bounding box has to with that :?

no. scaling is telling the model which size to have compared to its original state.

scale(2) does not mean the model is now 2 "jme-units" long. it means the model is twice as big as before.



assume you want to use a few models as collectable items in a small game. you found any of these models via google, and each one has a different size. one is 1,1,1, one is 1024,1024,768, the next one is even bigger.

now, you want each one to have the same size in your game, so what i did was:

get the bounding box. get the bounding boxes largest side. scale the model by 1/length of largest side. now, each model has the same size - it fits perfectly into a 1/1/1-box. now, scaling is equal to telling the node which size to have,

Why then can't you just scale the model twice?



The first time to get the standardized size in the way you described, and then to set it to the actual size?

About the question… don't know, I believe it doesn't have that.



I still don't understand why you can't do it manually. If you want to scale models by say height so they all have height of X, then for every model you do, pseudo:

scale(X/getHeight())

I still don't understand why you can't do it manually.



that's because there is no reason not to do it that way. i just wanted to know if jme supports already supports it.

it's probably because it's easy to do, implementing one line of code that is easy to come up with is good to be avoided IMHO.

i've done it, but it wasn't easy.

i have to deal with:

  • different bounding volumes
  • non-recursive getWorldBounds - if you have a chain of nodes, and one of them has no worldbounds -> the root has no worldbounds, but should have

hmm… then maybe it should been implemented after all :slight_smile: …make a RFE :wink:

where? how?

http://www.jmonkeyengine.com/jmeforum/index.php?board=6.0