UE4视图矩阵的左手视图矩阵与右手视图矩阵只有一个负号不同,如果取负,则为右手视图矩阵,如下所示。
constfvectorzaxis=(look at position-eye position ).GetSafeNormal ); structflookatmatrix : f矩阵{/* * * createsaviewmatrixgivenaneyeposition,a position to look at, andanupvector.* thisdoesthesamethingasd3dxmatrixlookatlh.*/flookatmatrix (constfvectoreyeposition,const f vector lok at pppot forceinlineflookatmatrix :3360 flookatmatrix (constfvectoreyeposition,const FVector LookAtPosition,const f vector up vector cor const FVector YAxis=ZAxis ^ XAxis; for(uint32Rowindex=0; RowIndex 3; rowindex ({ m [rowindex] [0]=(xaxis.x ) [ rowindex ]; M[RowIndex][1]=(YAxis.X ) [RowIndex]; m[RowIndex][2]=(zaxis.x ) [Rowindex]; M[RowIndex][3]=0.0f; } m [3] [0]=-eye位置| xaxis; m [3] [1]=-eye位置| yaxis; m [3] [2]=-eye位置| zax is; M[3][3]=1.0f; }参考链接UE4视图矩阵