# Cosine inaccuracy

Hi,

I’ve just started creating a ballistics function which will predict the flight path of an arrow.

The maths for this I have already confirmed works beforehand with old fashioned pen and paper.

The first part of the function requires me to get the horizontal velocity, this involves getting the Cosine of the angle the bow lies at, then multiplying it by the velocity the arrow will be fired at.

This all works on paper, for example:
With an angle of 34, Cos returns 0.829037572, this I understand is in degrees.
However when I started to transfer the function into code, it output the cosine as 0.2836622, I realise this is in Radians and not degrees, however once multiplied by Rad2Deg it outputs 16.25265.

I would have thought that passing in the Cosine output from the script into the Rad2Deg would output the same that the paper example provides, or is there another step I need to take to get the values matching ?

here is an example of the code encase anything doesn’t match up.

``````function FindPoint ( angle : int , velocity : float )
{
print(angle);
print(velocity);

//horizontal velocity = hv
var hv : float;
hv = Mathf.Cos(angle);
print(hv);
print(hv);
}
``````

Hello

Cosine use radians as parameter , so u have to change degrees to radians like this:

function FindPoint ( angle : int , velocity : float )
{
print(angle);
print(velocity);

//horizontal velocity = hv
var hv : float;