Using coremotion on ofCamera
minusplusminus opened this issue · 1 comments
minusplusminus commented
Hi,
I'm using coreMotion on ofCamera. Would it be nice to add an direct option for this?
Right now it's not working for me. Here's my code:
ofMatrix4x4 mat = coreMotion.getRotationMatrix();
ofQuaternion quart = mat.getRotate();
quart.set(quart.x(),quart.y(), quart.z() , quart.w());
cam.setOrientation(quart);
trentbrooks commented
This should be working out of the box. When you say not working, what exactly happens? The below works for me in landscape mode...
ofQuaternion quat = coreMotion->getQuaternion();
ofQuaternion landscapeFix(-quat.y(), quat.x(), quat.z(), quat.w());
cam.setOrientation(landscapeFix);
Update: I've just added an example project that uses an ofCamera https://github.com/trentbrooks/ofxCoreMotion/tree/master/ofxCoreMotion/example-camera