# How do I get Vertical and Lateral Speed?

I am working with UE4’s character blueprint and movement component, and I was wondering if there is a way to get the capsules vertical speed and its lateral speed separately? I would like my characters In Air animations to be controlled by how fast he is moving up or down, and how fast he is moving across the XY plane. I know how to get velocity in the Anim blueprints event graph and control a variable with it, but the velocity is both up or down, and left or right/front to back. So I need to be able to get its different velocities separately from one another. I am relatively new to blueprint, and I am an animator not a programmer :(. Any help would be greatly appreciated!

So, you want to have the x, y and z value of the velocity?

Try dragging out the velocity vector and search for “Break Vector” in the Context Menu. This will give you the 3 axis.

You can also have a look here:

Maybe you find something that fits your needs (:

Well, that worked, but is it now possible to have both X and Y control speed? Or do I have to combine those vectors somehow? I’ve looked in the link you gave, but I couldn’t find what I needed.

I just tried to have X and Y control two Speed variables, but that gives me weird results. Sorry I hope I don’t sounding too naive or dumb, gameplay programming is a whole new thing to me. I like It, but don’t understand some things yet.

Hm, i would need to test this myself, but taking the Z value for up and down movement and the X and Y for the should work.

Try to use the Z alone for the UP and DOWN thing and make a new vector out of the X and Y value. Set the Z value of this new vector to 0 and try to get the length (like you would do to get the speed from the normal velocity).

This SHOULD give your the speed of the character for X and Y…

If this is not working, then i would need to have a look at it myself, but i’m currently totaly stuck in learning for exams.

Ok will do. Or attempt. And that sucks. Exams are never fun. Unless they are in the major or field that you are in, they are a big waste of time. And money.

It Works!..Mostly. The X and Y vectors work, then I made a vector and got its length to drive the Z velocity, but the problem is its always positive. I was thinking I could get a positive speed for going up, and a negative one for down. Or something like that. I could then have a single 2d blendspace that controls all of my in air movements such as falling, or jumping before falling.

Can’t you use the “is falling” bool from the character movement component to simply multiply the value by -1 when its true?

I got it to work another way. I don’t think that would work, since I think the “is falling” bool is true whenever the character is in air, regardless of wether its up or down. At least I think. I got it to work by just plugging in the Z value of the vector to a variable without getting its length.

Thanks for the help though! Do I mark this as resolved?

I will do this for you. You can only mark answers, but i only commented by now.

For your solution: I thought you used the Z value directly and it was only positive (i should have noticed that it should be negative too). Using the length of it will make it positiv, because length is:

Sqrt(xx + yy + zz) and x and y were 0, so you got sqrt(zz) which will make it positive xD