Comments and answers for "Quick Angles Question"
http://answers.unity.com/questions/287789/quick-angles-question.html
The latest comments and answers for the question "Quick Angles Question"Comment by Chimera3D
http://answers.unity.com/comments/287923/view.html
Nvm figured something else out. Thanks for all the help!Sat, 21 Jul 2012 07:58:17 GMTChimera3DComment by Chimera3D
http://answers.unity.com/comments/287922/view.html
I've tried that already.
EDIT: Because the value never goes higher than 180 it just get's inverted and starts going back down until hits 0 on the other side.Sat, 21 Jul 2012 07:53:45 GMTChimera3DComment by Seth-Bergman
http://answers.unity.com/comments/287835/view.html
something like:
if(generalDirection > 180)
generalDirection = -(360-generalDirection);Sat, 21 Jul 2012 01:42:10 GMTSeth-BergmanComment by Seth-Bergman
http://answers.unity.com/comments/287815/view.html
aldo's code should work if this script is attached to the object at the vertex of the angle, otherwise replace vectors with the appropriate version of:
position1 - vertexPosition , position2 - vertexPositionSat, 21 Jul 2012 00:50:17 GMTSeth-BergmanComment by Chimera3D on Chimera3D's answer
http://answers.unity.com/comments/287799/view.html
Thanks for that information!Sat, 21 Jul 2012 00:24:11 GMTChimera3DAnswer by Seth-Bergman
http://answers.unity.com/answers/287795/view.html
see the script reference here:
[http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Angle.html][1]
they use two directions, not two points.. if you think about it, the angle based on two points in space would be relative to the point of origin..
[1]: http://docs.unity3d.com/Documentation/ScriptReference/Vector3.Angle.htmlSat, 21 Jul 2012 00:17:10 GMTSeth-BergmanAnswer by aldonaletto
http://answers.unity.com/answers/287794/view.html
Vector3 is a structure used to store many 3 float values, like points, vectors, angles etc. Transform.position and desiredPosition are points, not vectors, and Vector3.Angle is intended to be used with vectors. In this particular case, you're getting the angle between the vectors (0,0,0)->transform.position and (0,0,0)->desiredPosition, which normally makes no sense. If you want to measure the angle between the transform forward direction and the direction from the transform to the desiredPosition, you should use this:
generalDirection = Vector3.Angle(transform.forward, desiredPosition-transform.position);
A point is a position in the 3D world, while a vector is a direction - you can think of a vector as an "arrow" based on 0,0,0 and pointing to the desired direction. In order to calculate the vector that points the direction from position A to position B, subtract A from B:
directionAtoB = pointB-pointA;
The resulting vector shows the direction A to B, and its length (directionAtoB.magnitude) is the distance between A and B.Sat, 21 Jul 2012 00:15:36 GMTaldonaletto