SteveNi Posted October 27, 2016 Share Posted October 27, 2016 Hi So I have two vectors, one is the y vector (0,1,0) and the other is an arbitrary vector called @aim, given those two I want to find the angle between those two vectors. Now this should be pretty straight forward, just use acos(dot(@aim,@up)) wich gives the angle in radiants, and converted to degrees would be a value from 0 to 180, but what If I want to find when the angle is positive and when its negative (not just the difference)? For this I found this thread on the sidefx forums: https://www.sidefx.com/forum/topic/41091/?page=1#post-184272 And this Is what I have so far (look at the screenshot). The "problem" here is that if I set the arbitrary vector to be (0,0,-1) for example, I get a negative 90 degree angle, so I guess there is a specific direction wich the last piece of code "looks for"... This all comes down to know when the angle is greater than 180, but the original angle formula, as already said goes from 0-180. There is something wrong with my code or the bheavior is normal? If so how can I get the angle ranging from 0 to 360 degress? (I have to know when its greater than 180) Thanks Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.