Strange changes in relative scale

Hi all,
I’m noticing that whenever I change the rotation of a model and then ask for its scale relative to another model that has a certain transform set to it, I get different values, even though I didn’t explicitly change the scale of the first model. Here is some simple sample code that shows the issue:


The first print output is this:

LVecBase3f(0.245893, 0.323455, 0.222569) LVecBase3f(0.6, 0.6, 0.6)

While the second is this:

LVecBase3f(0.251558, 0.295914, 0.237806) LVecBase3f(0.6, 0.6, 0.6)

As you can see, there are differences in the relative scale value, even though I didn’t explicitly change the scale of the box-model at all. Is this just something to be expected, or is there a way to ensure there are no strange changes in scale and position, whenever the rotation is modified and a query is made relative to another model?

(This is important in my case, since the obtained values will be written out to an animation file and obviously if this persists, there will be undesired visible differences).
Any help is appreciated, thanks in advance.

It’s not that the box’s scale has changed, it’s that the scale you’re getting is measured relative to the smiley’s non-uniformly stretched coordinate space.

If you draw two squares with the same dimensions but different angles on a stretchy piece of tablecloth, then stretch out that tablecloth in one dimension, and re-measure the lengths of the sides, they will be different in each dimension. Worse yet, it is no longer possible to even describe the transformation that occurred to the squares as a scale tuple at all, since you’ve created a shear transformation. This is one of the reasons why non-uniform scales aren’t a great idea.

If you share what you’re trying to do or why this is a problem for you then I may be able to give more specific advice. Either you want to find a way to avoid non-uniform scales, or avoid taking the scale into account (eg. get it relative to the parent of the smiley, or set the scale on a child node of smiley), or you will need to deal with the shear transformations that inevitably result from combining rotations with non-uniform scales (see nodepath.getShear()).