Notifications
Clear all

[Closed] Find direction of modifier's gizmo axis

Hi

If I have transformation matrix from my modifier.

For example:
0.52 0.03 -0.85
0.36 0.88 0.26
0.76 -0.45 0.45
0 0 0

Is there a simple way to extract gizmo’s X axis direction in world space
from that matrix?

10 Replies
3 Replies
(@denist)
Joined: 11 months ago

Posts: 0

to get Gizmo’s transform in world space you have to know Modifier Context TM, Object Transform, and Gizmo Transform (Position, Rotation, Scale)

 elT
(@elt)
Joined: 11 months ago

Posts: 0

When it comes to maxscript and especially the transforms, I’d listen to whatever master denisT is saying before listening to anyone else.

(@denist)
Joined: 11 months ago

Posts: 0

thanks,
actually what modifier and its gizmo are we talking about?

 elT

I just played with this and it worked. Please test it yourself before you proceed using it. Also, I’m not sure this is the proper or easy way to go with it.

tempTransform = (in coordsys $Cylinder01 $Cylinder01.modifiers[#XForm].gizmo.transform) * (in coordsys world $Cylinder01.transform)
$Cylinder02.dir = tempTransform.row1

 elT

This also works for me, it appears declaring coordsys isn’t needed.

tempTransform = $Cylinder01.modifiers[#XForm].gizmo.transform*$Cylinder01.transform
$Cylinder02.dir = tempTransform.row1
 elT

At the risk of sounding totally kiss ass(and gay) and deraling the thread, I really have to say this… the other day I wanted to express huge amount of love towards you and in public. For some time I’ve been working on an object level transform brush as part of a feather creating and grooming system. I was at the end of my nerves with direction painting brush after trying a million different approaches. Then I found your post on interpolating matrices and quaternation. After an hour or so, I got it all working like a charm! And it was all due to your detailed and clear explanation in one of the threads I found while searching these forums. So here’s to you

Now, back to the thread…

Aren’t they all the same?

1 Reply
(@_sarge)
Joined: 11 months ago

Posts: 0

Thanks for replies, guys!

Just trying to implement my custom modifier. It’s gizmo has translation, rotation and scale.

Assuming we know all of the above, how can one find direction of gizmo X axis in world space?

Let’s assume a simpler case, that Modifier Context TM and Object Transform matrix are ident.
And Gizmo Transform matrix is like that:

0.52 0.03 -0.85
0.36 0.88 0.26
0.76 -0.45 0.45
0 0 0

How to extract this direction from it?

As i know it’s up to developers of a modifier how to control the gizmo. Some gizmos have transform (say matrix3) , some of them have position, rotation (and scale). So modifier gizmos are different.

lets say we have uvwmap modifier.
So

modi
is the modifier
node is the object the modifier applied to
gizmo is the modifier’s gizmo

its Gizmo transform in world space will be:


tm = [b]modi[/b].[b]gizmo[/b].transform * (inverse (getModContextTM [b]node modi[/b])) * [b]node[/b].objectTransform 

the X direction is first row in TM, or


dirX = normalize tm.row1

hopefully i didn’t miss anything…

Yes, it works.

Thanks!