Understanding Blender matrix


(Blacky_) #1

I don’t know if this is corect forum for that question. If no - please point me to better one.

I want to understand what exactly is stored in 3 Blender vectors: Loc, Rot and Size. I have no problems with calculating object matrix from it and mul vertex coordinates. The problem is I am using Blender objects in my game and I need some kind of “hierarchy”.

So let’s start with Loc. As far as I know Loc is position of pivot (object center). When I move center - Loc will change.

Rot is 3 rotation angles. But rotation of what? What is “initial state” - when angles are 0,0,0 ?

I completly don’t understand what is Size. Looks like it’s scale parameter, but scale of what? When scale is 1.0? When it’s smaller, when it’s bigger? I thought vertex coordinates are from -1 to 1, so scale would have sense, but they aren’t.

Let’s say I have complex machine made from many objects. In simukation each object is rotating, but machine doesn’t break to parts. I should set object center from Loc, so rotating won’t break everything. But what should I do with Rot and Size?

Most important question: can I set Rot to 0,0,0 and Size to 1,1,1 (but mesh should no change!) just like I can set Loc with “Centre Cursor” button?


(kurppa) #2

Most important question: can I set Rot to 0,0,0 and Size to 1,1,1 (but mesh should no change!) just like I can set Loc with “Centre Cursor” button?

Select object and Ctrl-A to apply size & rot…


(LukeW) #3

Yeah. And the object centre can be redefined - it doesn’t have to be the actual centre of the object.

Rot is 3 rotation angles. But rotation of what? What is “initial state” - when angles are 0,0,0 ?

The rotation measures the number of degrees from the default orientation. To reset the rotations back you can use alt-r. You can use N and shift-click to type in new rotation values. Basically RotX rotates around the X axis, etc. They seem to use standard maths/physics style definitions of rotations (though using ordinary degrees) where a positive rotation goes around the axis in an anti-clockwise direction. The rotation values that can be access using N seem to be adjusted +/- 360 every now and then… depending it at what times I use R to rotate and when I view the rotation values using N, the values can change a lot - even go up to 1000+ degrees… you could use ((angle+360)%360) to make sure it is always between 0 and 359 degrees… (I think that might work with floating point numbers - note that I haven’t really used phython).

I completly don’t understand what is Size. Looks like it’s scale parameter, but scale of what? When scale is 1.0? When it’s smaller, when it’s bigger? I thought vertex coordinates are from -1 to 1, so scale would have sense, but they aren’t.

Well whatever size the mesh is when size is reset is the size it will be when size = 1,1,1… this can be tweaked by using tab and then A and then resizing all the vertices using S. (you should clear the size first using alt - S before pressing tab)

The same can be done with rotation - you can adjust the default orientation by doing it in editmode (using tab and then A - but clear the rotation first, using alt-R)

Most important question: can I set Rot to 0,0,0 and Size to 1,1,1 (but mesh should no change!) just like I can set Loc with “Centre Cursor” button?

Use alt-R to clear rotation (set it to 0,0,0) and alt-S to clear size (set it to 1,1,1)