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
有沒有什麼明顯的我做錯了?
這可能是弧度問題 –