diff --git a/GVRf/Framework/framework/src/main/jni/objects/components/camera_rig.cpp b/GVRf/Framework/framework/src/main/jni/objects/components/camera_rig.cpp index 50c15b398..2dc06218f 100644 --- a/GVRf/Framework/framework/src/main/jni/objects/components/camera_rig.cpp +++ b/GVRf/Framework/framework/src/main/jni/objects/components/camera_rig.cpp @@ -139,19 +139,6 @@ void CameraRig::predict(float time) { } void CameraRig::predict(float time, const RotationSensorData& rotationSensorData) { - long long clock_time = getCurrentTime(); - float time_diff = (clock_time - rotationSensorData.time_stamp()) - / 1000000000.0f; - - glm::vec3 axis = rotationSensorData.gyro(); - //the magnitude of the gyro vector should be the angular velocity, rad/sec - float angle = glm::length(axis); - - //normalize the axis - if (angle != 0.0f) { - axis /= angle; - } - setRotation(complementary_rotation_*rotationSensorData.quaternion()); } diff --git a/GVRf/Framework/framework/src/main/jni/oculus/head_rotation_provider.cpp b/GVRf/Framework/framework/src/main/jni/oculus/head_rotation_provider.cpp index 80a28bdaf..58ef120b1 100644 --- a/GVRf/Framework/framework/src/main/jni/oculus/head_rotation_provider.cpp +++ b/GVRf/Framework/framework/src/main/jni/oculus/head_rotation_provider.cpp @@ -28,10 +28,13 @@ void OculusHeadRotation::predict(GVRActivity& gvrActivity, const ovrFrameParms& tracking = vrapi_ApplyHeadModel(gvrActivity.getOculusHeadModelParms(), &tracking); const ovrQuatf& orientation = tracking.HeadPose.Pose.Orientation; - glm::quat quat(orientation.w, orientation.x, orientation.y, orientation.z); - gvrActivity.cameraRig_->setRotation(glm::conjugate(glm::inverse(quat))); + const glm::quat tmp(orientation.w, orientation.x, orientation.y, orientation.z); + const glm::quat quat = glm::conjugate(glm::inverse(tmp)); + gvrActivity.cameraRig_->setRotationSensorData(0, quat.w, quat.x, quat.y, quat.z, 0, 0, 0); + gvrActivity.cameraRig_->predict(0); + const ovrVector3f& position = tracking.HeadPose.Pose.Position; - glm::vec3 pos(position.x, position.y, position.z); + const glm::vec3 pos(position.x, position.y, position.z); gvrActivity.cameraRig_->setPosition(pos); } else if (nullptr != gvrActivity.cameraRig_) { gvrActivity.cameraRig_->predict(time);