Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
OpenGL旋转太敏感_Opengl_Haskell_Matrix_Linear Algebra - Fatal编程技术网

OpenGL旋转太敏感

OpenGL旋转太敏感,opengl,haskell,matrix,linear-algebra,Opengl,Haskell,Matrix,Linear Algebra,我最近从使用不推荐的gl_*Matrix改为自己处理矩阵。一切似乎都很好,除了旋转大约是它应该的80倍。我可以在不更改任何其他代码的情况下切换到使用opengl的矩阵,并且可以进行旋转。完整的源代码已打开。最相关的功能如下: calculateMatricesFromPlayer :: GameObject a -> WorldMatrices calculateMatricesFromPlayer p@(Player{}) = let Vec3 px py pz = player

我最近从使用不推荐的
gl_*Matrix
改为自己处理矩阵。一切似乎都很好,除了旋转大约是它应该的80倍。我可以在不更改任何其他代码的情况下切换到使用opengl的矩阵,并且可以进行旋转。完整的源代码已打开。最相关的功能如下:

calculateMatricesFromPlayer :: GameObject a -> WorldMatrices
calculateMatricesFromPlayer p@(Player{}) =
    let Vec3 px py pz = playerPosition p
        Vec3 rx ry _ = playerRotation p

        -- Create projection matrix
        projMat = gperspectiveMatrix 45 (800/600) 0.1 100

        -- Create view matrix
        rotatedMatX = grotationMatrix rx [-1, 0, 0]
        rotatedMatXY = rotatedMatX * grotationMatrix ry [0, -1, 0]
        translatedMat = gtranslationMatrix [-px, -py, -pz]
        viewMat = rotatedMatXY * translatedMat

        -- Model matrix is identity by default
        modelMat = gidentityMatrix
    in WorldMatrices modelMat viewMat projMat

有没有什么明显的迹象表明我做错了?

因为一个圆中有
360度和
2*pi
弧度,而
pi
大约是3,所以很可能是以大约80的因子计算出来的,就是你使用角度作为
sin
的输入,
cos
tan
函数将输入作为弧度,因为
360/(2*pi)
约为80。

这可能是弧度问题吗