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?
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.
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).
I was refering to “velocity is generally non directional” → Velocity is a vector: Velocity - Wikipedia
Point in space is a coordinate represented by a vector data type and indeed has no direction.
The difference between the two is obvious when you compare 4x4 transformation matrix which has 1 for point and 0 for direction. Sure you can interpret the velocity as a point in space, but does that make velocity in general non-directional?
Velocity is the amount of travel defined as per frame you apply to said directional vector.
I guess what you are harping on is that it should be defined as Speed?
But then you won’t be able to pull the correct node from the engine, since there is nothing named Speed other than scalar variables.
Its called Velocity. And its a simple vector that expresses the direction in which the actor moves.
The above was specifically directed to pulling velocity, and extracting the direction of a scpecific axis.
The difficulty of the user is that if you pull forward vector it can tell you X, while Y and Z dont change.
Likewise, when you pull Right vector it tells you changes on Y, but not X or Z.
Hence, making it difficult for him/her to detect direction of travel.
Which is also wholly pointless - just get the direction from the axis input when dealing with controllers.
No point waisting resources on even the most basic calcs when you already know for a fact the input is saying “go left”…
Only, they wanted it that way, and likely I didn’t know better than to tell them not to even try it and stick to the axis 5 years ago.
Ergo, you get the code he kindly shared…
And the follow up info on how to properly set up your blendspaces…