Hi, Am wondering if anyone could help me with some math if possible.
Am trying to calculate the angle differency between my "vision" (Camera Y) and direction between objectPosition - myPosition,
I got help with this math so am not 100% sure if I know it outside in(my school math havent cover this section yet/or if it even will), from a little googling I found this
http://www.euclideanspace.com/maths/algebra/vectors/angleBetween/index.htm
with
angle = acos(v1•v2)
and I also found
http://answers.unity3d.com/questions/119313/Calculating-the-Angle-between-two-vectors.html
Even thou I remade my formular exactly the same it still won't work. my camera won't get any different value except 1 after the normalizing,although I get the 0>360 value from the rotation.
I am currently using the first person unity standard script that is NOT modified by any means.
But I know I get the correct input from the rotation and it does indeed change.
I know that normalizing is suppose to "minimize" vector into a |1| direction vector.(I think)
Help and some explanation would be awesome >.<
I tried to do this after I googled. My viewDirection always stays 1 after normalizing,
viewDirection = transform.eulerAngles;
objectDirection = transform.position;
viewDirection.Normalize();
objectDirection.Normalize();
d = Mathf.Acos(Vector3.Dot(viewDirection,objectDirection));
d *= Mathf.Rad2Deg;
↧