Notifications
Clear all

[Closed] Need help on "move $.selectedVerts"

I want to move a group of verts in world coordinates:

in coordsys local move $.selectedVerts [0,0,-0.2] -- Works for local coord
in coordsys world move $.selectedVerts [0,0,-0.2] -- Doesn't work for world coord

What gives?

5 Replies

Looks like move with vertex selection works in local coordinates only.
I don’t know why it is the way it is. Probably because sub-object selections assume you want to move in object space no matter how your object is placed in the scene, or because they parform the move below the transformation point on the modifier stack.

This one works in world coordinates:

move $.selectedVerts ( [0,0,0.2] * inverse $.transform )

What it does is assuming that the vector [0,0,0.2] IS in object space and transforming in out of object space by multiplying it with the inverse of the object transformation matrix. This gives you a new vector which is in world space as seen from the object’s “point of view”. The Move still thinks it is moving in local space, but the vector points in the correct world direction and fools it to move where you want.

Bobo, is there anything about maxscript you don’t know or can’t solve? I appeciate it
tremendously!

With this last info, I can finally complete my project script. It moves, rotates and scales an
object, or any kind of subobject selection small amounts in any direction in world or local
space. I don’t know if there is much interest for such a thing outside myself, but I feel a sense
of accomplishment though.

It also means maybe the hair I have pulled out trying to figure it out, will start to grow back!

Thanks Bobo!

Hmmm… not working for me, typo maybe?

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Nope, my fault.
I was testing a special case scenario – my object was located at the origin [0,0,0]
This means that the row4 of the transformation matrix was [0,0,0], which is a very special case. Moving the object away from the origin skewed the result as the TM contained additional translation info.

The following fixes this problem (I hope)

theTM = inverse $.transform
theTM.row4 = [0,0,0]
move $.selectedVerts ( [0,0,10]* theTM )

Works perfectly! Thanks Bobo!