[Closed] Object Position?
Hi Everybody, whats the command for object position (xform in Maya) in Max?
Thank You
well I am new to max script, but I think it is
yourObjectName.pos [0,0,0] or whatever coordinates you want
Originally posted by Technofreak
[B]Hi Everybody, whats the command for object position (xform in Maya) in Max?Thank You [/B]
The position property is
yourObject.position
or in short,
yourObject.pos
You can also access the complete transformation matrix using
yourObject.transform
This returns a Matrix3 value, whose .row4 is the position.
yourObject.transform.row4
Yet another way to access the position (JFYI, you will usually not do that) is
yourObject.pos.controller.value
which accesses the value stored in the position controller instead of accessing the result at PRS transformation level.
To access a single axis, use the .x, .y and .z elements of the Point3 value returned by the above methods:
yourObject.pos.x –returns only the X component.
yourObject.pos.y –returns only the Y component.
yourObject.pos.z –returns only the Z component.
And remember, in Max Z is up
To assign the value, you just put an assignment operator between the left-hand side (the property) and the right-hand side (the new Point3 value):
yourObject.pos = [10,20,30]
Advanced info: Assigning directly to the transformation matrix is not possible, you have to read the value into a variable, manipulate the value and write back, for example
tmp = yourObject.transform
tmp.row4 = [10,20,30]
yourObject.transform = tmp
while
yourObject.transform.row4 = [10,20,30]
will NOT work!
Hope this helps…
(You never know what you might need someday!)
Cheers,
Bobo