I am trying to create a very basic Blender project that will ouput the angle between two objects so that I can then use that angle to pan a surround sound decoder.
I have this working to an extent by using the getVectTo() function which ouputs the cosine of the angle between the two objects in relation to the owner object’s x axis, which is exactly what I want.
However, the problem is that this angle always flips between 0 and 180 degrees, whereas I need it to be between 1 and 360 degrees (anti-clockwise around the x axis) in order to work correctly with my sound decoder.
For example, if the second object is 90 degrees to the right of the owner object I want it to output 270 degrees and if it is 90 degrees to the left of the owner it should output 90 degrees.
Does anyone know how to achieve this? Unfortunately neither maths nor programming are my strong points so this has me quite confused! I think I may need to use a different reference vector rather than the x axis, but I am not sure how to implement this…