# Vector 2D to Scalar 1D?

Many conditions within systems in my game are based on velocity of the character to calculate certain things. Many use the full vector (x, y, z), while others I need to convert x and y into a 1 dimensional scalar (float) to get the overall speed.

I tried using Character Movement and breaking its velocity vector into 3 floats, and then converting the x and y to ABS (absolute float) and then adding x and y together. When I do this, depending on the direction Im facing the float can be as high as 800 when other times its quite low. In theory if I add them together properly, the 1d float should never change as long as the Max Walk Speed driving the character never changes.

So my question is, what formula or process would I need to do to convert a 2d vector into a 1 scalar as a float that represents current speed/acceleration?

The Pythagorean theorem would serve you well here. If you want to use a math node, the formula would be “sqrt(square(x)+square(y))”, no need for abs.

My bad I meant to post back on this saying I figured it out shortly after posting, despite it being an issue for some time ha. The node from any vector called Vector Length will basically do this as well, but I did try your suggestion and you are correct. It should be common sense but I got as far as Geometry 2 in High School and I didnt pay attention in Physics in College. I have a hard time saving formulas on memory unless they apply to real life, otherwise its like I memorize them for sake of getting a good grade. But I will say Ive never used so much math and had a lot of fun with it as much as I have working on my game in UE4.

Thanks for reminding me of that formula sir