Angle θ required to hit coordinate (x, y) when rotation point and projectile origin is not the same
I'm trying to make a Peggle-like turret that shoots rigid bodies that have a trajectory passing through the mouse position, the velocity is known, same for the start/end points, I only need to calculate the angle required.
I've managed to do the same this other guy did, I'm facing his same problem though, since I'm unable to adapt the trajectory formula to take the length of the muzzle into account, tried lots of vector based hacks to counter my trigonometry gap but there is no escape.
The formula used is this one: works well, but I'm limited to translate that into code, not able to include the distance from the rotation point and the muzzle.
And this is the image taken from the other post to show what I meant:
I hope to be enlightened by someone more mathy than me :p