Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Yes the vertical barrel angle can be solved separately ... . So one needs to solve the quadratic equation for the rotation on the horizontal plane, the rotation for the vertical plane can be solved with only pythagorean theorem without need for a solution of a quadratic equation.
@CustomCalc No,the quadratic equation is necessary for a EXACT solution on the horizontal plane.The question was about a exact solution,not a usual game hack which gives a wrong result, for example when the vertical barrel is directly on the "left/right rotation point of turret" or treated as such.The quadratic equation is for the rotation on the horizontal plane, and thus necessary!
You will propably run into precision issues with single precision if the lib uses single precision or if you use single precsion. To bypass the problem if the lib just uses single precision and you don't do as follows: Before converting the positions to single precision subtract the global position of the center cell from them, then put this as floats into the lib, then transform the results back.