how to find out an object's "true" transformation?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  04 April 2006
how to find out an object's "true" transformation?

I am trying to match transformation(trans, rot, scale) of one object to another. eg. if obj A is located at (12, 6, 5), i want to match obj B to that location as well. same idea goes for rotation and scale.

the problem right now is that if obj A is freezed, all its transformation info goes to zero. so at this stage if i want to match again, obj B would be transformed to the origin of the world which is not what i want.

logically i think maya has to store each object's "absolute" transform info somewhere (perhaps in a node) so that when two objects, for example at (1, 1, 1) and (5, 5, 5) are freezed, their values go back to 0 (1 for scale), but still maintain in their position and scale. The transform node in maya help looks like the node i am looking for, but after reading through the doc, i still dont find anything related to what i mentioned above.

perhaps someone with better knowledge of this node can give me some answers? thx!
 
  04 April 2006
check out the xform command.

you may need to use -piv
xform -ws -q -piv locator1;

read the docs on it..


.j
__________________
Make something idiot proof and they'll just build a better idiot
 
  04 April 2006
thx alot john_homer,

I dont know too much about the mel commands and nodes, and your post certainly helps alot. As i was looking through the transform node of the object in attribute editor, i noticed under Pivots there are local/world space options which is exactly the same as what you have quoted in your post.

the good thing is: maya does keep "absolute" values of object's pivot points, so i can use them to match other object using these values.
the bad thing is: what if the user changes the piovt away from the object's center? then everything becomes all "relative" again.

i still dont get the part how and where maya stores an object's absolute transformation values? or its actually in the transform or xform node, i just dont see it?
 
  04 April 2006
while we're talking about xform, I've got an issue where i grab world position
Quote: float $pos[3] = `xform -q -ws -a -rp $object`;
and apply that position
Quote: xform -ws -a -t $pos[0] $pos[1] $pos[2] $object2;
So, simple stuff. Done it many times before. But no matter what, the second object will not go to the proper position. Are there any known, predictable causes for xform to fail at appying values?
 
  04 April 2006
Originally Posted by Goon: Are there any known, predictable causes for xform to fail at appying values?


I would suspect...

frozen transforms.
parents with transforms.
parents with frozen transforms.

but I dont have time to ests 'em all.. ;^)

.j
__________________
Make something idiot proof and they'll just build a better idiot
 
  04 April 2006
Originally Posted by john_homer: I would suspect...

frozen transforms.
parents with transforms.
parents with frozen transforms.

but I dont have time to ests 'em all.. ;^)

.j


so bassically if its frozen you cannot no longer determine its true transformation in terms of world space?
 
  04 April 2006
no, because the transform has been applied to the vertices and is no longer present in the transform node
 
  04 April 2006
this is more complicated than i initially thought of. so for what i am trying to do, it would make more sense to match translate of an object to a single vertex? what about rotation and scale?

the reason i want to implement something like this is because i have switched from XSI to maya, and match tranformation is a very common tool in XSI. so i would do something similar in maya as well.
 
  04 April 2006
in
Originally Posted by tciny: no, because the transform has been applied to the vertices and is no longer present in the transform node


interesting...

what about a locator?
or null?

.j
__________________
Make something idiot proof and they'll just build a better idiot
 
  04 April 2006
a locator has a point (single vertex), however afaik, freeze transforms only affects those nodes that represent geometry (lattices, nurbs, polys, subdivs).

anyhow, given 3 points on similar meshes, the transform can always be deduced, however i've not got time at the moment to go through it.
 
  04 April 2006
Why would you want a match transform using vertices? XSI doesn't do this as well. Transformations can always be matched, as long as you strictly work with world-space coordinates. Also, instead of dealing with complex hierarchies you should just unparent the specific object temporarily to circumvent any frozen-transform problems the parent might introduce. The world space coordinate of any object is it's rotate pivot position (which is the local axis in XSI and the thing that match transform operations in all applications match, and can be queried as john already pointed out). Frozen transforms are great when you're sure your objects position (controllers etc) are finalized but in most other situations, especially during modelling they are a bitch to work with…which is why i wrote a lil "center pivot" script that does NOT freeze transforms, as mayas default center pivot command does. Your case is similar. Matching rotation and scale will again pose some problems due to the way maya stores transforms. Froozen rotation and scale can't be so-to-say reverse engineered as you won't be able to derivate any kind of scale or orientation from the vertex data, unless you know that some edge should pe parallel to a given axis or your meshes are identical as Robert pointed out. In short, don't try match transforms on frozen objects for anything else then translation.

Cheers, Lennart

Last edited by LennO : 04 April 2006 at 01:51 PM.
 
  04 April 2006
nessus I made a script to snap objects. You can download it here

Take a look at it.

Cheers


-S
__________________
My name is Leo Getz!! Anything you need, Leo gets, get it?!?!?

My Homepage
 
  04 April 2006
Stucky, I have downloaded your mel script. Its the same case as i mentioned above. it works after freeze as long as the pivot is still in the center of the object. but if the user changes it, say the object is at (5, 5, 5), but he/she moves the pivot of rot and scale back to (0, 0, 0), the script will match the new object to (0, 0, 0) which is not the result i want.

LennO
Quote: Froozen rotation and scale can't be so-to-say reverse engineered as you won't be able to derivate any kind of scale or orientation from the vertex data...


now i think i understand the problem. same idea as "tciny" mentioned as well i think. actually this makes more sense to me now.

my thinking is: objects have volume in 3D space, its logically not acurate to say its position in 3D space anways, more precisely a coordinate system can only repersent one vertex a time. and an object is made of vertices(in polygon case), so even its frozen its values of vertices still preserved anyhow, and thats how maya keeps track of an object's position in 3D space.

learn something new everyday! thank you guys!!
 
  04 April 2006
Originally Posted by nessus: Stucky, I have downloaded your mel script. Its the same case as i mentioned above. it works after freeze as long as the pivot is still in the center of the object. but if the user changes it, say the object is at (5, 5, 5), but he/she moves the pivot of rot and scale back to (0, 0, 0), the script will match the new object to (0, 0, 0) which is not the result i want.


But that's what matching transforms does. As in XSI, the transformation values _are_ the pivot point location and orientation. When you match two objects transform you want pivot of object B to lineup with pivot of object A. As a result they have matching transformation values: their world matrix is identical. If you want two identical or almost identical objects to line up, regardless of their pivot point location, you'd approach it differently. What you'd want to do is to get the bounding box center of object A (which is a an attrib on any transform node.) Then you'd center the pivot of the object you want to move (Object B). Then do a move in worldspace coords to 0 0 0. Freeze Transforms again and then move it to the previously stored bounding box center values of object A. This works with frozen objects. However, you _cannot_ regain rotational information if an object rotation has been frozen, unless you do the following (which i believe is related to the last part of your message, which I honestly, didn't understand):

If you know that one edge of an object would be parallel to say, the global x axis, and another edge parallel to global z (if the object was at 0 0 0 rotation) you can create two vectors (x and z) for your new transform matrix by substracting vertex coordinates. The third axis (y) would be computed as x cross z. This will involve a lot of calculation and requires the user to select the specific edges/vertices, if they do exist at all. In the end though, this has not much to do with matching transforms. Matching transforms is just that: Transforms, not objects.
 
  04 April 2006
Thank you LennO, sorry i understood how XSI does match transformation in a very wrong way.

By the way, "you _cannot_ regain rotational information if an object rotation has been frozen...". did u actually mean move the pivots away from the center of its object(which is the default position for all the pivots)? cuz i dont know how u can freeze a pivot in maya?
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:49 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.