Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Local and global transformMatrix (OfNode)

$
0
0

@pxt wrote:

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!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles