To obtain the objects position and rotation I’m using [B]xform[/B]
MEL command.
Everything is clear and accurate when I’m trying to obtain the rotation of an object with xform
in both world and object space.
Also everything is all right when I’m trying to obtain the position (xform -q -ws -t) of an object in world space.
But when I’m trying to query the local position (xform -q -os -t) of an object with rotation values
that are different from zero it (xform
) gives me weird result.
Maya help documentation has an extremly brief description about all with regard to space transformations and
nearly zero explanation of how maya actually performs coordinate evaluations (except crookedly drawn transformation matrix).
So I’ve wrote the script in order to understand maya objectSpace realization better:
string $selNodes[] = `ls -sl`;
for ($sel in $selNodes) {
float $wsSelPos[] = `xform -q -ws -t $sel`;
float $osSelPos[] = `xform -q -os -t $sel`;
print ("ws position: " + $wsSelPos[0]+ " - " + $wsSelPos[1]+ " - " + $wsSelPos[2] + "
");
print ("os position: " + $osSelPos[0]+ " - " + $osSelPos[1]+ " - " + $osSelPos[2] + "
");
}
I have a parent dummy group (xyz: 2-0-0 world coordinates)
with a poly cube inside it (xyz: 8-0-0 world coordinates).
When cube has zero Y-rotation I can obtain a local position relative to the parent group without any problems
otherwise I’m getting weird local position values for the cube.
It would be a real salvation for me if you will give a detailed explanation for this situation: