Hello everyone!
I’m currently making a game where an object needs to be given a force in the Z and Y axis, depending on a given power and angle value. In order to do this I use the following mathematical formula:
powerY = (power * Mathf.Sin(angle));
powerZ = (power * Mathf.Cos(angle));
Here, the angle is determined by the angle of another gameobject (called directionMeter) in Radians (a value between 0 and pi). However, when I used transform.rotation.x, I got a value between 0 and 1, and after a full rotation it would give a value between 0 and -1. I tried using EulerAngles as well, but that gave me a value between 0 and 90, then 270 to 360 (skipping everything between 90 and 270). It seems that Unity is giving me very weird values that I can’t use in my formula. How would I go about solving this?