I’m just starting with panda, and I have a problem that seems to be really easy to solve, but I couldn’t figure out how.
I have one actor that is made of 5 bones, 1 that works as a column and holds all the another.
In blender I’ve set 3 of the top bones (Head, back and leg) to be children of the tripod bone, and the tripod is child of the column bone. My problem is, I want to set the scale of the column bone and don’t affect the others. But when I set the column Y scale to another value, doesn’t matter what I do with the scale of the children bones, they always inherit the value from the column.
Here is what I’m trying to do:
The scale applied to a joint is, I believe, relative to that of its parent. As a result, setting a joint’s scale to its initial value won’t necessarily undo the effect of a scale applied to a parent bone.
If I’m not much mistaken, you should be able to undo the effect of the column’s scaling by applying an inverse scale to the “tripod” bone. In mathematical terms, my understanding is that the final scale of a joint is the result of multiplying together the scales of all the joints in its hierarchy, itself included. Thus, if the parent bone has a scale of x, applying a scale of 1/x should produce a scale of 1. (If your initial scale isn’t 1, just multiply the intended scale by 1/x: newScale = initialScale * (1/x), simplified to newScale = initialScale/x.)
The code might look something like this:
newScale = value + self.columnInitialHeight
This inverse scale should affect the children of the “tripod” bone, just as the scale of the “column” bone affected the tripod and all its children, so applying the inverse scale to just the “tripod” bone should be sufficient, I think.
I might add that adding non-uniform scales (ie scale that is not the same in the X, Y Z directions) to a bone is generally a bad idea, since this complicates scaling of normal vectors, and can result in incorrectly looking lighting esp. in combination with hardware skinning. Just a caveat to keep in mind.
Do I gather correctly that what you want is for the column to extend upwards, lifting the object on top of it? If so, perhaps consider doing this by moving the “column bone” instead of scaling it. To implement this, you might place one more bone as a parent of the “column bone”, set to affect the bottom of the column (perhaps with decreasing effect on higher vertices). This remains still while the “column bone” moves upwards, holding the base in place while the column extends.