How to get world space coordinates? (Maya)

I’d like to get/set the world relative coordinates of an
entity, even if it’s in a hierarchy.

I’m linking the translation of two bones in
Hypershade, but that data is an offset from the
respective parents instead of absolute position.

I’m new to Maya so I might be missing something
trivial. I’ve been reading the help/web for quite
a while now and only found MEL and SDK solutions
for this kind of conversion.

float $pos[] = xform -q -ws -t;

That should query the world-space transform value of the node.

Edit: Wait, what do you mean “only found MEL and SDK solutions”… surely a MEL solution is what you want? Or do you want to do this in Python? Not sure what you mean.

I’d like to do everything with nodes in the
Hypershade editor, similar to how the relation
constraint is implemented in MotionBuilder:

I’d like to be able to create all kind of relationships
between attributes, possibly in a visual manner.

With the DecomposeMatrix node I can get world relative
position/rotation but I can’t use it because my target bone
expects parent relative input data…

This thread might hold some answers

http://forums.cgsociety.org/archive/index.php/t-383291.html

zoltan - there is also a matrix mult node (createNode pointMatrixMult) in there - so you can multiply together the parent inverse matrix of the node with the world matrix of whatever, do a decompose on the resulting matrix and voila - local coords.

I’m sorry but I still have no idea what to do. I’d really
appreciate a screenshot which shows a setup which
does the same/similar thing as the linked image.

The pointMatrixMult has only one matrix input so
I used multMatrix but linking the result back to the
target node caused syntax errors for the matrix
inputs. Also, I don’t really see where I could add
simple math expressions like on the image.

my bad - for some reason I thought pointMatrixMult could also mult two matrices together. I thought there was a node that multiplied matrices together…

I guess you could write an expression to do it.

[QUOTE=macaronikazoo;10188]my bad - for some reason I thought pointMatrixMult could also mult two matrices together. I thought there was a node that multiplied matrices together…

I guess you could write an expression to do it.[/QUOTE]

mm = cmds.createNode('multMatrix')

I am not sure what you want in the end. You could use parent constraint to get world coordinates as well, that´s the easiest. Parent constraint a locator to your bone and the locator´s matrix is the world matrix of your bone. Or you could use worldMatrix and parentInverseMatrix together to get your final world space matrix (I don´t remember exact attributes, I dont have maya right now).
Or are you trying to find relative transform value of one to another tranform?

As I wrote earlier I did manage to get the world relative
transforms but I couldn’t do anything with them because the
target bone expected parent relative data. I’m sure something
could be done with further math but I ran out of time.

Still thanks for the help.