I am making a game and I want the camera to be at the side of the two players, approximately 10 metres from the centre point between the two with rotation so it is 90 degrees from the line between the two, example picture here:
Let's coordinates of given points are (Ax,Ay), (Bx,By)
In vector form:
C = ( B+A )/2 + - 1/2 * Perpendicular( 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
Choose sign '+' or '-', and point C will lie to left or to right relative to AB line
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.