Hi, I’m new in Unreal dev, and I’m trying to achieve a jetpack effect to port a cocos2d-x game of mine. I calculate the rotation angle of my character, and call Launch Character several times:
Problem is, it gets really fast, so I would like to limit the max velocity, but I can’t find any option to do this. If you are familiar with cocos2d-x, I’m searching for a blueprint equivalent of:
character->getCPBody()->v_limit = 5000;
Oh, and I don’t want to use ZOverride because I don’t want to lose the gravity acceleration.
I made this workaround, but it doesn’t work as well as v_limit on cocos2dx:
Clamp Vector Size was extremely helpful, thanks! Just one problem: speed isn’t limited when applying force with “Launch Character”. Here’s how I’m doing:
(where “Avoa” is a method that calculates the rotation and apply force using Launch Character)
This works well when I stop calling Avoa and character begins to fall.
(sorry for the non-english method names)
Velocity is a vector. If you want to limit it to a max speed, do the following:
Grab the current length of the
Feed the current length of the
velocity vector into a ‘clamp float’ node,
where the min value is 0, max value
is 5000 (or your max speed).
Normalize your velocity vector.
multiply your velocity vector by
your clamped value.
Alternatively, you can also just use the node “Clamp Vector Size” and apply it to your velocity vector. This does the same thing I described above.
ah, ok, inverting “Set Velocity” and “Avoa” did the trick! The order of execution in BP seems to be the inverse of what I thought!