Local and global transformMatrix (OfNode)

Hello!
if i do this: i have control over the global Position of the object (using translate and rotate) and local position and local orientation using ofNode.

ofPushMatrix();
            ofTranslate(position);
            ofRotate(ang, vec.x, vec.y, vec.z);
            ofRotateX(angle.x);
            ofRotateY(angle.y);
            ofRotateZ(angle.z);

            primitive.setOrientation(localAngle);
            primitive.setPosition(localPosition);
            primitive.draw();
            ofPopMatrix();

What i want now is to use ofNode also to change the globalPosition and globalOrientation…
So i do this:


 entityNode.setGlobalPosition(position);

                glm::vec3 rotationEuler = glm::vec3(ofDegToRad(angle.x), ofDegToRad(angle.y), ofDegToRad(angle.z)); //rotate 45 deg on x, then 90 on y
                angleQuat = glm::quat(rotationEuler);

                entityNode.setGlobalOrientation(angleQuat); // THIS IS not working (both transformation at the same time)

 entityNode.setOrientation(localAngle); 
entityNode.setPosition(localPosition);

and it works fine… but if i also want to change the local Position, the node only do the last transformation, so i cant change both transformations at the same time using ofNode. How can i fix it? i need to use ofNode because i need that information to fill a matrix. Thanks!

Hi, What are you trying to achieve. It looks overly complicated. instead of using ofTranslate and ofRotate you can nest the ofNode objects. there is an example in examples/3d.

The following you posted is wrong.

Instead use

curRot = glm::angleAxis( ofDegToRad(angle.z), {0,0,1}) * glm::angleAxis(ofDegToRad(angle.y), {0,1,0}) * glm::angleAxis(ofDegToRad(angle.x), {1,0,0});