Rotate and Translate the Hip in World Space (not Local)

I am writing a script to correct poses that have a mix of Figure Transformations and Hip Transformations.

At present, I can fix the Translation problem as both Figure and Hip are in World Space.

Unfortunately, I've only found how to change the Rotations for the Hip in Local Space. Adding the Rotations from the Figure to the Hip are totally unacceptable without first converting the Hip Rotations to World Space.

I need to know how to pull the World Space Rotation values from the Hip and then set the Hip to the corrected Real World Rotation values.

I hope someone here can help me.

Comments

  • Are you using DzNode::getWSTransform() and DzNode::setWSTransform() (and similar)?

    These methods appear to me to work correctly. If you are using DzNode::get?RotControl() etc. then yes, you are restricted to local space.

     


    function printNode (node) {
      print (node.name);
      print ("L: " + node.getLocalTransform());
      print ("W: " + node.getWSTransform())
    }
    
    var pNode = Scene.getPrimarySelection();
    printNode(pNode);
    
    var cNode = pNode.getNodeChild("hip");
    printNode(cNode);
    
    pNode.getYRotControl().setValue(90);
    printNode(pNode);
    printNode(cNode);
    

    Executing Script...
    Genesis8Female
    L: [1,0,0,0,1,0,0,0,1,0,0,0]
    W: [1,0,0,0,1,0,0,0,1,0,0,0]
    hip
    L: [1,0,0,0,1,0,0,0,1,0,0,0]
    W: [1,0,0,0,1,0,0,0,1,0,105.178,1.82482]
    Genesis8Female
    L: [1.98762e-07,0,-1,0,1,0,1,0,1.98762e-07,0,0,0]
    W: [1.98762e-07,0,-1,0,1,0,1,0,1.98762e-07,0,0,0]
    hip
    L: [1,0,0,0,1,0,0,0,1,0,0,0]
    W: [1.98762e-07,0,-1,0,1,0,1,0,1.98762e-07,1.82482,105.178,3.62703e-07]
    Result: 
    Script executed in 0 secs 4 msecs.
    
  • Blank_CanvasBlank_Canvas Posts: 36
    edited September 2023

    Thank you so very much.

    I need the code to push new values to the Hip's Rotation and Translation in World space. I need to know how to push new Transformations to the cNode in your above sample.

    Additionally, the DAZ Docs don't seem to explain what the array values are other than m11, m12, m13, m14, m21, m22, m23, m24, .... No explanation on what they affect.

    Post edited by Blank_Canvas on
Sign In or Register to comment.