|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
|
I need to move the mapping gizmo according to the mapping coordinates. I can do so with
a = $.modifiers[1]
a.gizmo.position.x = a.gizmo.position.x + (x / 2.0)
a.gizmo.position.y = a.gizmo.position.y + (y / 2.0)
provided the coordinate system for the map is in the same direction as the object.
If I rotate the map 90 degrees, the above snippet moves the map in the same direction rather than at 90 degrees.
What do I need to do to get the map to move in the local (map) coordinates?
Thanks in advance
|
|
|
|
hi you can try following code:
theMod = $.modifiers[1]
theGizmoTM = theMod.gizmo.transform
theGizmoTMLocal = theGizmoTM * (inverse($.transform)) offsetX = theGizmoTMLocal.row4.x/2
offsetY = theGizmoTMLocal.row4.y/2
theGizmoTMLocal.row4 = [offsetX,offsetY,theGizmoTMLocal.row4.z]
theMod.gizmo.transform = theGizmoTMLocal*$.transform
if you rotate the object , you should take the whole object’s transform into consider :D
cheers!
|
|
|
|
Thanks so much for the input. I didn’t think it would be as easy as using position after posting my question, later realizing I had to use transforms.
This is what I have
theMod = $.modifiers[1]
xyz_l = 96
xyz_w = 218
theMod.length = (xyz_l as float)
theMod.width = (xyz_w as float)
theGizmoTM = theMod.gizmo.transform
theGizmoTMLocal = theGizmoTM * (inverse($.transform))
offsetx = theGizmoTMLocal.row4.x + (xyz_w/2)
offsety = theGizmoTMLocal.row4.y + (xyz_l/2)
theGizmoTMLocal.row4 = [offsetX,offsetY,theGizmoTMLocal.row4.z]
theMod.gizmo.transform = theGizmoTMLocal*$.transform
and the attached is a sample mesh, a simple rectangle with planar mapping.
the code above works but if I rotate the mapping 90 degrees, the gizmo still moves in the same direction as before rotating the gizmo.
| Attachment
|
|
|
|
|
|
I’m really surprised that no one else has replied with a possible solution.
|
|
|
|
I can’t give a definitive answer but have a look at “coordsys” in the MXS help - it may be of some use.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
One problem is that I am confused as to what coordinate system I should use or even understand transforming.
|
|
|
|
So am I (confused) - which is why I didn’t reply before.
From a quick read at the help, translations are always performed in the World coordinate system, so if you want (for example) Local rotation, you would need “in coordsys local” to force the issue.
Whether that is relevent to mapping coordinates I’m really not sure - but it can’t hurt to have a play with it.
Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.
|
|
|
|
I already took a look at that, but i will go back and have another read in case I missed something. I really appreciate your input. Thank you so much.
|
|
|
|
I am unable to use transforms to move the mapping in the direction I want. But I have come up with a workaround using the mapping position. I check the ‘rotationpart’ of the mapping transform. If it is (quat 0 0 -1 0) then it isn’t rotated and I move the mapping, x to the right(top view) and y is up. If it’s (quat 0 0 0.707107 0.707107) then it’s rotated, x is up (top view) and y is left.
Not the way I wanted but it works.
Thanks to those who gave their input.
|
|
|
|
|
|