Negative Velocity for Left and Right 2D movement

Hello there,

how can i get the negative velocity of the character movement so the animation blendspace will work correctly?

I made a 1D blendspace with a Maximum of 200 and minimum of -200.

Its a 3D character with a planar X movement if this is important to know, also the event graph is set up as usually >pawn owner> get velocity > vector lenght > set speed.

So the velocity is always between 0 and 200.

On the axis mappings i got 2 different axis button setups, A for left (-1), D for right (1)

My character is a character class, but im using my own controller, so i made a reference for my player character inside the controller and made the default setup for the movement input for both axis mappings/value etc.

The animation up to 200 works of course, but applys also for the movement into the other direction, to the left.

What would be the easiest way to fix that problem and is it even possible the way im trying to do it ?

thx

Make variables, facing left, (facing right is then just !left) Set accordingly with inputs. Use that boolean to drive a pose blend by bool that uses two 1d blendspaces from 0 to 200.
That way when the character stands still it can also face the correct direction.

I give it a try, Thx man !

Alternatively,
You can do this with one blendspace, ranging from -200 to 200 like you wanted

what this code does is gets the dot product of your normalized velocity and the Y axis,
it then divides that result with it’s absolute value of itself, to bring the value to either -1, or +1,
(if we dont do this, moving in the Z axis will effect the blendspace)
then your speed is multiplied by the -1 or +1, to get your speed as +200 if you’re moving right and -200 if you’re moving left

this is the blend space I set up to test it

hope this helps

Hey man, thx i just noticed today there’s a new answer. It works fine so far with the previous method adeptus mentioned. But i will going to use your method if i need this another time, thank you :smiley: