Skip to content

Instantly share code, notes, and snippets.

@reidblomquist
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reidblomquist/4ceb1bd3d380a2c33c33 to your computer and use it in GitHub Desktop.
Save reidblomquist/4ceb1bd3d380a2c33c33 to your computer and use it in GitHub Desktop.
constantly rotating; needs to mimic rotation of accelerometer and stop
// accx, accy, and accz are all float vals from a 3-axis accelerometer
// how can i make this camera simply mimc the accelerometers position on a quaternion slerp
// Sample data: onNewMessage, message: DATA, x, 0.26, y, 0.06, z, -0.95, Range, +-8g
curRot = ofQuaternion(accx, cam.getXAxis(), accy, cam.getYAxis(), accz, cam.getZAxis());
cam.setPosition((cam.getGlobalPosition()-mesh.getCentroid())*curRot +mesh.getCentroid());
cam.rotate(curRot);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment