Hi! I’m trying to set up some strafing animations and tried to use the character’s Y velocity to determine whether or not he is moving left or right.
But I found that velocity is world aligned, not local. So if my character faces south instead of north, the strafe direction is inverted.
Can I translate this to local space in my event graph by using something like the controller’s rotation somehow?
There are a few nodes that may help, but a velocity is generally non directional, so I’m a bit confused as to what you are using.
I’m basically trying to find a value I can use to see if my character is strafing left or right. I tried using the velocity Y axis, but it appears to be world space, rather than local.
If you use the Get Velocity node on the actor you should get a world aligned vector that describes your speeds.
The sum of the 2 (x and y) would be your total speed in that forward direction I believe.
which would or should not exceed the maximum set in the movement component.
you can use the value of X (positive or negative) to determine your heading, coupled to the value of the forward vector.
I got something going, but I’m not getting the range of values I’m expecting, and I need some help re-adjusting them.
My character has a directional velocity of -300 to 300. This means that at 0, it’s moving straight forward, at 150 it’s moving diagonally, and 300 it’s moving right.
I managed to replicate this by using a rotatevector node.
It works perfectly for 0, 300 and -300, but when give my character input to move diagonally, I get a value of 212/-212 instead of 150.
So the blending of my animation doesn’t match the direction my character is actually moving, making it slightly skate across the ground.
How would I adjust this?
Edit: Figured it out! My blendspace was set up as my character movement was handled by a Speed * 360 degree Orientation setup.
Turns out my setup is 2 axis based instead. (X is forwards and backwards, while Y is left and right.)
I just had to set up my blend space accordingly. (So left and right is literally on the left and right of the blend space and not in the corners).
Also - There are built-in functions on FTransform to transform positions and directions to local space.