Hello, I want to Debug between two Vectors. here is my Code so far:
using UnityEngine;
using System.Collections;
public class Angle : MonoBehaviour {
float Angle360(Vector3 v1, Vector3 v2, Vector3 n)
{
// Acute angle [0,180]
float angle = Vector3.Angle(v1,v2);
// -Acute angle [180,-179]
float sign = Mathf.Sign(Vector3.Dot(n, Vector3.Cross(v1, v2)));
float signed_angle = angle * sign;
// 360 angle
return (signed_angle <= 0) ? 360 + signed_angle : signed_angle;
Debug.Log("signed_angle <= 0) ? 360 + signed_angle : signed_angle;");
}
}
But somehow it doesent work and i dont get any error. Can somebody tell me whats wrong there? Or how it should look right?
KalleH
2
You have your Debug.Log after return statement so it doesn’t ever reach it and your code inside Debug.Log is simply a string so it would just print the text inside it and not the angle itself.
Just simply save the the value you are returning as a float and before return statement use Debug.Log(variableName) to print it.