Results 1 to 11 of 11

Thread: How to get world space coordinates? (Maya)

  1. #1
    ; DROP TABLE Users; Zoltan's Avatar
    Join Date
    Apr 2009
    Location
    Budapest
    Posts
    252

    Default 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.

  2. #2
    Technical Artist MoP's Avatar
    Join Date
    Jul 2008
    Location
    London, UK
    Posts
    87

    Default

    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.

  3. #3
    ; DROP TABLE Users; Zoltan's Avatar
    Join Date
    Apr 2009
    Location
    Budapest
    Posts
    252

    Default

    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.

  4. #4
    ; DROP TABLE Users; Zoltan's Avatar
    Join Date
    Apr 2009
    Location
    Budapest
    Posts
    252

    Default

    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...

  5. #5
    for loop mattanimation's Avatar
    Join Date
    Jul 2010
    Location
    Mesa, AZ
    Posts
    202

    Default

    This thread might hold some answers

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

  6. #6

    Default

    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.

  7. #7
    ; DROP TABLE Users; Zoltan's Avatar
    Join Date
    Apr 2009
    Location
    Budapest
    Posts
    252

    Default

    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.

  8. #8

    Default

    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.

  9. #9
    integer
    Join Date
    Oct 2008
    Location
    Madison, WI
    Posts
    45

    Default

    Quote Originally Posted by macaronikazoo View Post
    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.
    Code:
    mm = cmds.createNode('multMatrix')

  10. #10
    Geeky Artist maulik13's Avatar
    Join Date
    Jan 2010
    Posts
    21

    Default

    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?

  11. #11
    ; DROP TABLE Users; Zoltan's Avatar
    Join Date
    Apr 2009
    Location
    Budapest
    Posts
    252

    Default

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •