Notifications
Clear all

[Closed] Local space

I’ve been banging my head on the wall with this one. I’m trying to rotate and object in screen space. How can i achieve this without using maxscript’s “in coordsys screen” or the hacky solution of linking my object to a null helper

To test just select and object and from a 3d viewport execute the snippet

here is a maxscript sample:

obj = selection[1]

viewtm = inverse(viewport.getTM())

pt = point transform:viewtm wirecolor:green box:True

pt.pos = obj.pos

obj.parent = pt

tm = Matrix3 1

rotateX tm 0

rotateY tm 0

rotateZ tm 45

translate tm [0,0,0]

pt.transform = (inverse tm) * pt.transform

delete pt
1 Reply
nodes = selection[1]
targettransform = inverse (viewport.getTM())
rotationtransform = (EulerAngles 0 0 45) as matrix3
newtransform =nodes.transform * inverse  targettransform * rotationtransform * targettransform
newtransform.row4 = nodes.transform.row4
nodes.transform = newtransform