Set velocity on character movement

Is it possible to set a new velocity ? I mean override the actual velocity to use a new.
When the user touch the screen, my character has to move on diagonal up-right or up-left.
Actually I use AddImpulse but I have to set a vector of 500.0 on up and right axis but the behavior is not great.
Thanks for the help

Hi Alundra,

Yes it is very possible. What you will want to do is pull out your character movement component and from the pull out a “Get Velocity”, a “Set Velocity”. From there, if you want to add to your your velocity you would do a Vector + Vector and input your Get velocity into one node and add your desired velocity on the other and feed that into your Set Velocity.

If you simply want to change directions at the same speed you would only use Get Velocity, Rotate Vector and then Set Velocity. You need a rotation to work from for that though.

If you are starting from a dead stop(0,0,0) you do Make Vector (500,0,0), Rotate Vector then set Velocity.

You could do a line trace from your actor to the location you touched. From there it is Vector - Vector, Hit location - Actor Location---->Into a “Make rotation from X” and feed that into your Rotate Vector rotation input. i think that is the correct math

I have to add the information that it’s a 2D movement, not needed to trace to have a hit point, just want to move on diagonal XZ-Plane.
What you are explaining looks complicated for a simple thing which is to set the linear velocity.
In unity you simply do :

Using PhysX or Bullet Physics you can override the linear velocity in one line too.
No way to simply override the linear velocity like that using blueprint ?

It’s Character Movement—> Set Velocity

But this exactly the same as what you are already doing except you are adding impulse(velocity), this just sets a new course and only in a single direction. If you want multi direction you need to be able to determine the angle in some way and rotate your current velocity to match the angle.


Does your character rotate when you press to either side of the screen? If it does you can use your actor rotation instead of a line trace

It’s a simple movement style of flappy bird (the character fly), one touch or click on the screen and the character go on diagonal (right or left).
I looked for “Set Velocity” but only “Get Velocity” is found when I search the node by name.
Maybe the only solution is to manage the movement using “Set Actor Location” manually.
Using “Add Impulse”, if I move on the right then on the left, I have to move twice to really move on the direction or the character stops and fall (gravity).
If I move twice on the right the character move really fast, which is not the wanted behavior.
Just an override of the current velocity is the wanted behavior, looks like manually doint it using “Set Actor Location” is the only solution.
I saw the node timeline could be used to create curves then use this value on “Set Actor Location” to move X and Z.

There is no “set velocity” command, but I believe it might be possible to use the “launch character” node. On this node there is an ‘override XY velocity’ and an ‘override Z velocity’ checkbox if I recall. I did not experiment with this but I believe it is supposed to fully override the current velocity with the new velocity- if so it might be what you are looking for.

Excelent, that override correctly the velocity !

I know you already solved this but just to clarify, Set Velocity does exist. I use Set velocity on my character all the time. You can’t directly access it from the pallet window, you have to drag it from your character movement


You right I finally found it, I tried but that only move my character instantaneously, not push it on one direction instantaneously.
The result is like if I used “Set Actor Location”.