2015-05-12 43 views
0

我需要製作一些東西like this,除了用鼠標旋轉它外,您只需要在文本框中輸入俯仰偏航滾動,它就會旋轉。我試圖修改這個,但它似乎無法正常工作。有沒有像任何圖書館做這種東西?在webgl中製作一個加速度計/陀螺儀

+0

遺憾的鏈接似乎錯在這裏新的鏈接[http://jaanga.github.io/gestification/cookbook/pitch-roll-yaw/readme-reader.html] –

回答

0

如果你想使用庫,我建議glMatrix。你會做類似如下:

var q_ori = quat.create(); //holds orientation 

// do stuff ... 

quat.rotateY(q_ori, theta); //(accumulate a change in yaw by theta) 

//finally convert to rotation matrix with mat3 or mat4.fromQuat 

mat4.fromQuat(outMatrix, q_ori); 

//pass this into a shader or whatever