World-Space-Coordinate-System using setWSRot() has a wrong? outcome.

madheadcrashmadheadcrash Posts: 0
edited December 1969 in Daz SDK Developer Discussion

Hello,

I don't understand the world-space coordinate system in DAZ3d at the moment. I searched in the documentation but found nothing what helped me so far. I hope someone can explain it to me.

I tried for some experimentations to set the left shoulder to -45° with the following code. I assumed the rotation would be given in RAD. Found nothing about the unit in the documentation. Maybe I searched in the wrong place?
I used a Genesis 2 Male for this.

QString lShoulder = "Left Shoulder";
DzNode *nodelShoulder = dzScene->findNodeByLabel(lShoulder);
nodelShoulder->setWSRot(DzTime(0),DzQuat(0.0f*DZ_FLT_DEG_TO_RAD,0.0f*DZ_FLT_DEG_TO_RAD,-45.0f*DZ_FLT_DEG_TO_RAD,true));

The outcome was as followed:
Twist: -5.99
Front-Back: -4.78
Bend: -75.0 (seems to be maximum)

After this I tried it without conversion to RAD

QString lShoulder = "Left Shoulder";
DzNode *nodelShoulder = dzScene->findNodeByLabel(lShoulder);
nodelShoulder->setWSRot(DzTime(0),DzQuat(0.0f,0.0f,-45.0f,true));

The outcome was as followed:
Twist: -0.13
Front-Back: -12.41
Bend: -75.0

I expected the outcome would be
Twist: 0
Front-Back: 0
Bend: -45.0
Why isn't it this way?

Comments

  • dtammdtamm Posts: 126
    edited December 1969

    Hmm, I think you are using the wrong DzQuat constructor. Something like this is probably what you where trying to do.

    
    QString lShoulder = "Left Shoulder";
    DzNode *nodelShoulder = dzScene->findNodeByLabel(lShoulder);
    nodelShoulder->setWSRot(DzTime(0), DzQuat(nodelShoulder->getRotationOrder(), DzVec3(0.0f,0.0f,-45.0f * DZ_FLT_DEG_TO_RAD)));
    


    Better would be:

    
    QString lShoulder = "Left Shoulder";
    DzNode *nodelShoulder = dzScene->findNodeByLabel(lShoulder);
    nodelShoulder->getXRotControl()->setValue(0);
    nodelShoulder->getYRotControl()->setValue(0);
    nodelShoulder->getZRotControl()->setValue(-45);
    
    
  • madheadcrashmadheadcrash Posts: 0
    edited December 1969

    Hi,

    I just tested it. Your were right. I used a wrong constructor.

    now It's working the way I had in mind.

    Thanks for your help!

Sign In or Register to comment.