Features of using the scale matrix

To manipulate object transformations with matrices, Blender includes the “mathutils” module in which the “Matrix” class is defined. With this class, you can simply create the necessary transformation matrices – translation, rotation, and scale.

The following command is used to create a scale matrix:


SCALE_VALUE – the multiplier. How many times you need to change the scale with the resulting matrix,

MATRIX_SIZE – the size of the resulting matrix,

AXIS – a vector that determines on which axes the object will be scaled with the resulting matrix.

For example, to create a matrix of 2x scaling along the X-axis, you need to execute the following:

Everything looks simple, but this method has one non-obvious feature.

If you need to create a scaling matrix along all three axes simultaneously, it seems logical to specify all the axes in the “AXES” parameter when calling this method :

But this doesn’t work, the resulting matrix is ​​not correct!

To create a scaling matrix along all three axes, you need to create separate scaling matrices for each of the axes and then multiply them:

Now we get the correct matrix for scaling along three axes.


Author: Nikita

Blender add-ons developer and articles writer.

0 0 vote
Article Rating
Notify of
0 Comment
Inline Feedbacks
View all comments