Re: Working on tower lean - could use some trig help!
Posted: Tue Apr 07, 2015 9:54 pm
Okay. Do you have any suggestions for how I might turn two lean-angles into a quaternion, and then use that to project points on the line? I don't want to make the annealer find the solution itself. It's more precise my way, and the annealer already has enough wildcard variables to solve for.Polygonhell wrote:You use the X and Y portions of the vector as the inputs to the annealer rather than the angles, you compute Z as sqrt(X*X + Y*Y).
If you want to clamp X and Y to reasonable values you clamp them to the sin of the desired angle so for say +/- 10 degrees you's clamp abs(X) and Y to be < 0.17364817766
Your optimizer should end up with approximate tower vectors, but you need to phrase the other math in terms of the tower vectors rather than the angles, I suspect that you will find the other math turns out easier/cheaper without the angles. All the sin/cos stuff just goes away and you end up with a bunch of dot and cross products instead.
What this doesn't let you do is deal with tower rotation in addition for that you need to use a quaternion, the trivial explanation of a quat is it's basically equivalent to a rotation about an arbitrary axis, and in fact toy can trivially compute one from that, but that's a somewhat toy explanation.
When I worked in games we always said if you deal with geometry and convert it to angles to solve a problem you're doing it wrong.