Admittedly it was really difficult as I don't know trigonometry enough. I guess there could be simpler ways to do it, but I took this approach:
Imagine the screen is a plane that partially covers a sphere, then calculate the position of mouse from the screen to where it would be on the sphere. There you have the point of the sword, and you can calculate where you want the arm to be.
|