Set Character Movement -> Set Velocity doesn't work vertically (but it works horizontally)

Hi, I am adding to the blueprint of an enemy a code in which, when it touches the player (which is a FirstPersonCharacter), then, make the player fly backwards (as if the player had been hit by an explosion). (It is and axploding enemy when it reaches the player).

First, I tried with AddImpulse, which worked fine. But it became a problem when multiple enemies touched the player at almost the same time and the AddImpulse stacked together, applying a force greater than the desired one.

So, I am trying with replacing the node AddImpulse with the node Set Velocity. I have had to increased the numbers of the forced applied to get the desired velocity, and the player moves correctly horizontally in X and Y, but it doesn’t fly up in Z even the slightest. I have tried with the highest number possible a float can reach and it keeps moving only horizontally.

To test, in the FirstPersonCharacter Bluprint I have added inmediately after the tick event the SetVelocity node and set it to 0, 0, 10000000000, and, when clicking play and checking that this is the value the velocity vector has all the time, the player still doesn’t go up.

What is happening?

The movement component likes to glue the char to the ground. See if you can change the movement mode to flying, right before setting velocity.

1 Like

It worked. Although I had to set the movement mode to Falling instead of Flying for the player not to remain at the air. Thanks for putting me in the right direction.

I am wondering, if the walking mode keeps the player on the ground, how does the Jump function works? I haven’t been able to open it to see it. Does it use an AddForce or AddImpulse because it knows that you won’t stack these forces? Unless you could configure a double jump… I don’t know.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.