FruehBird Posted April 4, 2017 Share Posted April 4, 2017 (edited) How does the pivot work when using the make transform Vop node? I am trying break down and figure out the function of the Make Transform node using python (Outside of any 3d software). The Translate is pretty basic as I can just place them into a matrix as they are x = m[3][0], y = m[3][1] and z = m[3][2]. For rotation I am using the following: def EulerToMatrix(Rotation): x, y, z = Rotation XM = M3([[ 1, 0, 0], [0, math.cos(x), -math.sin(x)], [0, math.sin(x), math.cos(x)]]) YM = M3([[math.cos(y), 0, math.sin(y)], [0, 1, 0], [-math.sin(y), 0, math.cos(y)]]) ZM = M3([[math.cos(z), -math.sin(z), 0], [math.sin(z), math.cos(z), 0], [0, 0, 1]]) return (ZM * YM * XM) I can then just pipe this information into the Matrix4. The problem I have now is that I cannot find any information that I can understand on how to apply the pivot to the matrix4. It's not as simple as just adding. I have attached a file that has the make transform that I am using to test against. The pivot seems to be linked to the rotation and so I am guessing it is related to the scale as well. Is there any way to break down how this pivot transforming works? MakeTransPiv.hip Edited April 5, 2017 by FruehBird Quote Link to comment Share on other sites More sharing options...

FruehBird Posted April 5, 2017 Author Share Posted April 5, 2017 (edited) I got closer with setting the pivot as the transform of a second matrix and multiplying the two but something is still off. With the pivot the position becomes (0.42052, 11.0109, 7.3853) With the multiplying it becomes (0.54003, 11.050306, 7.68421) ApplyTransPiv.hip Edited April 5, 2017 by FruehBird Quote Link to comment Share on other sites More sharing options...

FruehBird Posted April 5, 2017 Author Share Posted April 5, 2017 I got it working! In order to apply a pivot to a matrix you need to invert the original matrix before multiplying it by the pivot. After that you will need to invert it again and add the pivot xyz to the position on the matrix. ApplyTransPivWorking.hip 1 Quote Link to comment Share on other sites More sharing options...

## Recommended Posts

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Note:Your post will require moderator approval before it will be visible.