关于UE4坐标换算涉及到的知识
关于UE4坐标换算涉及到的知识
Editor上的Translation
导出Json格式的Translation
所以问题就来了,怎么换算的(这里注意Rotation的变化,Location是一样的,但是3D场景空间转2D屏幕就会涉及转换的问题)
http://www.360doc.com/content/17/0727/09/31913486_674462117.shtml
齐次坐标的理解(经典)
https://blog.****.net/janestar/article/details/44244849
|
平行线是否可以相交 |
A是B的子集 |
无穷表示 |
欧氏几何空间(笛卡尔空间) |
否 |
A |
(∞,∞)[不好表达] |
透视空间 |
是 |
B |
(x,y,0)[齐次坐标] |
齐次坐标用N+1维代表N维坐标,即(X,Y)->(x,y,w)
X = x/w;Y=y/w
当w为0时就可以表示无穷远处了
(x,y,w) <=> (x/w,y/w)
Homogeneous Cartesiam
齐次坐标有规模不变性,如(1, 2, 3), (2, 4, 6) 和(4, 8, 12)对应同一个Euclidean point (1/3, 2/3),任何标量的乘积,例如(1a, 2a, 3a) 对应 笛卡尔空间里面的(1/3, 2/3)。
证明两条笛卡尔空间中的两条平行线在透视空间中可以相交
1.AX+BY+C=0
2.AX+BY+D=0
因为C≠D,如果C=D,则两条线相同。
如果在透视空间里面,用齐次坐标表示x/w,y/w代替X,Y
A(x/w)+B(y/w)+C=0 -> Ax+By+Cw=0
A(x/w)+B(y/w)+D=0 -> Ax+By+Dw=0
解为:(x,y,0),即两条直线相较于(x,y,0),在无穷远
参考:
UE4 坐标系坐标轴旋转轴
https://blog.****.net/qq_35760525/article/details/78400629
1.UE4的x轴在前边
2.UE4和unity都是左手坐标系。
判断方法:四指由X卷向Y,看大拇指的朝向和Z轴朝向,由此判断使用的是左手坐标系还是右手坐标系。
3.UE4中,Rotation的X是翻滚角Roll,围绕X轴旋转。Y是俯仰角pitch,围绕Y轴旋转。Z当然是偏航角yaw了,围绕Z轴。
(翻滚)Roll,(俯仰)Pitch,(偏航)Yaw如下(顾名思义很好记):
4.UE4里,蓝图中的rotation的三个依次为roll,pitch,yaw。C++中FRotator里是pitch,yaw,roll。
C++
5.
Get component relative rotation -> get forward vector, that will return the local forward vector OR if you want the world forward vector...Get component world rotation -> get forward vector. The rotation return will be based on the mesh's root x axis no matter which way it is facing.
get forward vector //获得物体的自身的前方
Get component world rotation -> get forward vector. //获得根节点X轴的前方
四元数与欧拉角之间的转换
https://blog.****.net/xoyojank/article/details/5682944
Atan2
https://en.wikipedia.org/wiki/Atan2
反正切 Arctan在线计算器
http://www.ab126.com/geometric/2080.html
如下图