Math question, angles and magnitude stuff

im using arctangent2 to find the angle between 2 vectors.

arctan2(magnitude(axis of rotation), dotProduct(start vector,end vector));

so rotating from vector1 direction to vector 2 direction along axis “axis”
angle degrees where angle is that arctan function.

Problem is it requires square rooting. Can i arctangent with a square adn get the right answer still?

just curious – could it be something else causing the problem?

Like literally in say 1980 (thirty+ years ago) you’d hear people say “if possible avoid a square root!”

That’s irrelevant today. Consider how many calculations Unity is doing all the time man ??! All the rotations and so on… every single frame… I mean … my goodness … it’s not even a compiled language, you’re using vast layers of interpreters, physics engines, and what not.

I use and I see used Atan2 constantly, in fairly high performance code (every sort of typical 3D game etc), eg…

__angleCCW = Mathf.Atan2(b.z,b.x) - Mathf.Atan2(a.z,a.x);

So … just a thought man ! Maybe forget about it :slight_smile:

wasnt square root fucntion

was a debug.drawray running every update and creating rays that lasted 5 seconds.

My bad.

Question answered cause it doesnt need an answer.