get quaternion from rotation matrix. There are any references about get quaternion from rotation matrix in here. you can look below.