在webgl中制作加速度计/陀螺仪

时间:2015-05-12 01:55:22

标签: webgl

我需要制作一些like this除了用鼠标旋转它之外,你只需要在文本框中输入俯仰偏转滚动它就会旋转。我尝试修改它但它似乎无法正常工作。有没有像任何图书馆那样的东西?

1 个答案:

答案 0 :(得分: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