2
我最近从使用已弃用的gl_*Matrix
切换到自己处理矩阵。一切似乎都工作得很好,除了旋转大约是它的80倍。我可以切换到使用opengl的矩阵而不更改任何其他代码,并且旋转很好。完整的数据来源于Github。最相关的功能在这里:OpenGL旋转太敏感
calculateMatricesFromPlayer :: GameObject a -> WorldMatrices
calculateMatricesFromPlayer [email protected](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
有没有什么明显的我做错了?
这可能是弧度问题 –