首页 > 编程知识 正文

视图矩阵推导,ue4蓝图和c++区别

时间:2023-05-03 07:01:54 阅读:36399 作者:2039

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视图矩阵

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。