get box height

24 June 2015 20:48
Ok, so I need to something like this: from 1 to 7 seven boxes making a pile. (I can make deep copies, that's ok)
But I should be able to change the height for each box, and then if needed, place a new box over the previous one…

It should be like: Z position of BOX 2 = (Z position of BOX 1) + (height of BOX 1)
where the height of BOX 1 could vary

I have tried this using shape keys and visually it works, but the returned height of the object is always the same!

Should I try bone deformation? and how I could get the bone absolute position? (the bone position should give me the position for spawning a new box on top of the original)
25 June 2015 11:44
Unfortunately, there are no API methods to get the object bounding box size after object's shape change. We'll add it to our TODO list.
For now, you can use shape keys. In Blender, you should create shape key for your object. Key 1.0 value will match a 2.0 object size, for example. And key 0.0 value will match original object size. If you want to get 1.5 object size, you should apply 0.5 key value etc.
26 June 2015 13:15
Yes, I was trying with shape keys at first, and it was working ok. But then I didn't know how to calculate the distance between the new height of the box (think of it as a pile of books) and the next box on top of it.

let's imagine I have 4 boxes in a column, and I need to change the first box's height (the one in the bottom) using shape keys, thats easy, and tranlating the rest of the boxes in the Z-axis, that's easy too, but, How can I calculate how much I need to move boxes 2, 3 and 4? If I had a way of knowing the real height after the shape key change, this would be easy too…
26 June 2015 15:11
Take a look at this example:

And don't forget to setup your browser for loading local resources to watch the example
26 June 2015 17:31
Thanks! I will check it out!
26 June 2015 18:12
Just exactly what I needed, thanks!
Please register or log in to leave a reply.