It’s anyway to detect if the user is rotating their phone (like a steering wheel) over z-axis with cocos2d-x?
I know how to calculate Pitch and Roll:
const double alpha = 0.5; double fXg = 0; double fYg = 0; double fZg = 0; //Low Pass Filter fXg = pAccelerationValue->x * alpha + (fXg * (1.0 - alpha)); fYg = pAccelerationValue->y * alpha + (fYg * (1.0 - alpha)); fZg = pAccelerationValue->z * alpha + (fZg * (1.0 - alpha)); //Roll & Pitch Equations double pitch = (atan2(-fYg, fZg) * 180.0) / M_PI; double roll = (atan2(fXg, sqrt(fYg * fYg + fZg * fZg)) * 180.0) / M_PI; //rotate 180 degrees pitch=(pitch>=0)?(180-pitch):(-pitch-180);
But how can i calculate yaw / tilt for get the rotation?
Regards and thanks for the help!