How to modify the scale of bones in a SceneKit model?

I have a SceneKit scene comprising a reference node linked to a Collada

.dae
exported from blender. Into that scene I programatically add models with animations loaded from further
.dae
files. The animation keyframes only modify rotation and translation of the character's skeleton. As a cheap way of introducing some slight character variety (e.g. slimmer or stockier), I thought I could look into the model and selectively modify the scale of the bones (not in the length axis).

While the bones can be found like this:


let left = character.childNode(withName: "Thigh.L", recursively: true)


... this has no visible effect on the rendered model:


left.scale = SCNVector3(2, 2, 1)


Applying the equivalent scaling in Blender does achieve the desired effect, but I'm trying to avoid the overhead of maintaining and exporting multiple versions of a model.


Is there a way to make this approach work?


(I've also asked this question on StackOverflow, but here probably has a higher density of SceneKit experts)

Replies

Scale seems to be working fine with the skinned mesh in SceneKit Editor at least. Maybe animation overwrites your scale with (1, 1, 1) after your changes? Even if you hadn't animated scale doesn't mean it won't be applied each frame...

Your may try to do same think without animation to check this.

Sorry for the slow response - I was distracted by other things. Your observation is correct. One inconvenience (although a perfectly reasonable one) is that scale adjustments propagate to child bones too, so if for example I scale up a characters leg thickness, their feet do the same, so I need to apply the inverse scale to keep the size the same.

I need to look into ensuring that the exported animation contains no scale data, or perhaps modify it on-demand and feed SceneKit with the modified version.