Converting a rotation(degree) to a vector3(usable in a RAY)

Hello,

-So the problem i’m struggeling with, is that I want to convert a rotation(in degrees) to an angle usable in a RAY. but currently I haven’t found a real solution.
I’m pretty sure there is an build in function for it but I just don’t know it’s name.

-The exact thing that i’m trying to do, is to cast a Ray from an certain object directly to an other object. I’ve suceded in changing the position into and angle. But this angle is in degree and can’t be used in Ray’s (atleast I think so) so i’m looking for a way to put this angle in a Ray

Thanks in advance for helping need some more information on my coding (something I don’t think will be necessary) Just ask!

So I found a solution maybe not the best but its solid

So to convert the angle I took de position difference between the 2 objects (posDif)
and divided then by eachother so (X/Z and Z/X) if you use only this you will still be able to get a value > 1, so I also divided the smallest digit by the largest digit this makes sure you get the right value

float v = posDif.x/posDif.z;
float w = posDif.z/posDif.x;
if (v > w)
{
w /= v;
}
else
{
v /= w;
}
new Vector3 (v, 0 ,w) //vector to use in ray.direction