Turning Line Traced normals into usable float angle values

Hey guys. I’m working on taking the normals from a line trace and trying to separate the vector into 3 floats but I don’t know how to get the returned floats into a single angle. I’m trying to get the angle of the floor the character is walking ontop of. I only need the X Angle Value. Y and Z aren’t needed since its a 2D movement. Can anyone help?

My numbers are off, because of a big rounding error and basically me just eyeballing the values, but I found the relation between the Z value of the normal and degrees of angle to be roughly:

degrees = sqrt (10049 - 10000*normal-Z) - 7

It’s pretty much spot on at a 30 degree angle, but below it it counts the angle as a bit less and above it a bit higher. (5 degree angle is like 2.3 and a 45 degree angle is 47.5)
And as much as math is an exact science, you can always butcher it like I did and get something vaguely similar to the actual result. :smiley:

I actually found that if you use atan of the X and Z values of the normal vector, it’ll return a usable radian for the X angle.

Hi ,

You should look into the break vector and make vector nodes. This breaks the vector into X,Y,Z float values. If you just want the X value, you can simply connect the break vector x value to the make vector x value and leave the other two blank.

Hey , like I said in the post before yours, I got the radians of the angle from splitting the vector and taking X and Z and plugging it into an ATan node. Worked out pretty well.