Hi,

I'm trying to rotate 3D Model by finger swipe.

But it happend incorrectly rotation.

If I rotate my phone on landscape, It is rotate reversely.

I thought because there are two different coordnates system, world coordnate system and the pose coordnate system.

So, I want to know how to get the rotation information from the Pose matrix.

Is there anyone who can tell me about it?

Thank you!

You're welcome - thanks for posting your solution!

Thank you soooooooooo much!!!

I'm so happy!!

Thank you so much!!

============= for someone worry about same problem ===============

step1. create rotation matrix for PoseMatrix in renderFrameQCAR

QCAR::Matrix34F poseMatrix = trackable->getPose();

poseRotMatrix = GLKMatrix3Make(poseMatrix.data[0], poseMatrix.data[1], poseMatrix.data[2], poseMatrix.data[4], poseMatrix.data[5], poseMatrix.data[6], poseMatrix.data[8], poseMatrix.data[9], poseMatrix.data[10]);

step2. get rotation matrix for detected 3D object in touchesMoved

GLKVector3 locationVec3 = GLKVector3Make(location.x, location.y, 0);

GLKVector3 lastLocVec3 = GLKVector3Make(lastLoc.x, lastLoc.y, 0);

locationVec3 = GLKMatrix3MultiplyVector3(poseRotMatrix, locationVec3);

lastLocVec3 = GLKMatrix3MultiplyVector3(poseRotMatrix, lastLocVec3);

GLKVector3 diffVec3 = GLKVector3Make(lastLocVec3.x - locationVec3.x, lastLocVec3.y - locationVec3.y, lastLocVec3.z - locationVec3.z);

float rotX = GLKMathDegreesToRadians(diffVec3.x / 2.0);

float rotY = GLKMathDegreesToRadians(diffVec3.y / 2.0);

float rotZ = GLKMathDegreesToRadians(diffVec3.z / 2.0);

bool isInvertible;

GLKVector3 xAxis = GLKMatrix4MultiplyVector3(GLKMatrix4Invert(touchedObject.rotMatrix, &isInvertible), GLKVector3Make(1, 0, 0));

touchedObject.rotMatrix = GLKMatrix4Rotate(touchedObject.rotMatrix, rotX, xAxis.x, xAxis.y, xAxis.z);

GLKVector3 yAxis = GLKMatrix4MultiplyVector3(GLKMatrix4Invert(touchedObject.rotMatrix, &isInvertible), GLKVector3Make(0, 1, 0));

touchedObject.rotMatrix = GLKMatrix4Rotate(touchedObject.rotMatrix, rotY, yAxis.x, yAxis.y, yAxis.z);

GLKVector3 zAxis = GLKMatrix4MultiplyVector3(GLKMatrix4Invert(touchedObject.rotMatrix, &isInvertible), GLKVector3Make(0, 0, 1));

touchedObject.rotMatrix = GLKMatrix4Rotate(touchedObject.rotMatrix, rotZ, zAxis.x, zAxis.y, zAxis.z);