Rotating 3D model in world coordinates(global) can't find solution

Hi there,

I read 3 float numbers from serial. The three numbers are rotation angles. Not euler, but 3 rotation after eachother. I tried with ofx3DModelLoader::setRotation() but this is local rotate. I have tried ofxAssimpModelLoader::setRotation(), but it rotates also in local. Tried with normal glRotatef(), but that is also the same. Could You plese tell me how can I manage it? Wich way should I search?

Now I am on a way to make something like:


ofQuaternion RotPhi, RotTheta, RotPsi, Rotation;


RotPhi.set(ofQuaternion(phi, ofVec3f(1,0,0)));
RotTheta.set(ofQuaternion(theta, ofVec3f(0,1,0)));
RotPsi.set(ofQuaternion(psi, ofVec3f(0,0,1)));
Rotation.set(RotPhiRotThetaRotPsi);
cam.setGlobalOrientation(Rotation);

With cam it looks like it works (not 100% sure). Can I have the 3D model as a ofNode somehow?
Sorry, I am beginner in openframeworks, but I can show you what is all about and why:
I am working on a VR Glove, I prepared something in Unreal Engine 4 , but I have problems there with the serial communication. It works, but it is too slow. After packaging is worse. In openframeworks I have no lagg, it works perfect. So I would really like to have it work in OF.

I appreciate your help.

P.S.: the VR Glove in work: https://www.youtube.com/watch?v=ffVCm8a78Ow
What you can see lagg, is because of communication. In OF is really no lagg. :slight_smile:

Resolved.

  1. make quaternions
  2. Rotation_quaternion=RotPhiRotThetaRotPsi;
  3. Rotation_quaternion.getRotate(angle,axis);
  4. ofRotate(angle, axis.x, axis.y, axis.z);
  5. model.draw(OF_MESH_FILL);

hope it helps someone

Looks cool. Cheers.

1 Like