Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在制作一个游戏,我希望相机位于两个玩家的一侧,距离两个玩家之间的中心点大约 10 米,旋转,因此它与两个玩家之间的线成 90 度,示例图片如下:
让我们给定点的坐标是(Ax,Ay),(Bx,By)
向量形式:
C = ( B+A )/2 + - 1/2 * 垂直( BA )
BAx = Bx-Ax ; BAy = By-Ay
BAPerpX = - BAy ; BAPerpY = BAx
Cx = Ax/2 +Bx/2 +- BAPerpX/2
Cy = Ay/2 +By/2 +- BAPerpY/2
选择符号“+”或“-”,C点相对于AB线位于左侧或右侧