PDA

View Full Version : Set a world position value into object

 noobmode07-19-2012, 01:48 PMLike this, i have an object with pos 1 1 1, after freeze transform it, the value return to 0 0 0. Now i want to set the obj's pos to 2 2 2 in world space using mel, how can i do it? beside subtract it's own world pos's value and the add with 2. I want more direct way to do this. Anything would help. Thanks
NaughtyNathan
07-19-2012, 02:13 PM
the -rpr (rotation pivot relative) flag is the key here
move -rpr -ws -a 2 2 2 objectName;

noobmode
07-19-2012, 02:57 PM
Oh wow, thank Nathan, never know that.

But, is there another way to do this? not using the move command but set object attribute or calculate the position in actual space? I mean convert the world pos's value into object local pos's value, we can use object matrices to convert it but it's too complicate i think.

sciLoop
07-19-2012, 04:09 PM
Oh wow, thank Nathan, never know that.

But, is there another way to do this? not using the move command but set object attribute or calculate the position in actual space? I mean convert the world pos's value into object local pos's value, we can use object matrices to convert it but it's too complicate i think.

The world position is identical to the objects local position value if you do freezeTransformation.
The object appears at the same position because the vertices were offset.
The only value which points to the original center of the object is now the pivot point.

noobmode
07-19-2012, 04:27 PM
So the vertex being offset?, i though object matrix being reset to original, only the object's pivot still on worldSpace?

pm.getAttr(obj.name.matrix)

the object matrix is original

sciLoop
07-19-2012, 04:39 PM
So the vertex being offset?, i though object matrix being reset to original, only the object's pivot still on worldSpace?

pm.getAttr(obj.name.matrix)

the object matrix is original

Yes, the objects transform node has set its resulting matrix to identity...and the shape node`s vertices are offset so they appear at the same position.

edit: the pivot point is in object space and multiplied with the parent matrix to yield a world position. And also, that value is offset when freezeTransformation is applied.

noobmode
07-19-2012, 04:49 PM
That's the problem, right now i'm working with nurbs's Cvs, because its vertex being offset so it's really hard to get it right in place by set attr or something like that. Include if object is rotate, since the object's matrix is difference, so i want to ask an simple way to do it.

I can get the object's local pos return it to the original and add with new value. But i don't think it's a good way to solve the problem

CGTalk Moderation
07-19-2012, 04:49 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.