Setting velocity?

Hello…

Quick question, but I can’t find the answer :

I can set actor’s location with “Set Actor Location”.
I can set actor’s rotation with “Set Actor Rotation”.

Where is something like “Set Actor Velocity”?

What is the fastest way of launching an object along a given vactor (object is simulating physics)?

1 Like

you need to get the relevant component of the actor, and then apply velocity to that

for static mesh you want the static mesh component

for character you want the Character Movement component

1 Like

If this is for a spawned projectile you can also give it a ‘Projectile Movement’ component so it automatically shoots when spawned.

It can be achieved: Actor->GetRootComponent()->ComponentVelocity = Velocity;

Every Actor has a variable Velocity, you can edit it. BUt it will only affect the velocity if your actor has a movement Component.

Trying to set my velocity to 0,0,0 before I respawn (tried after also but same results)
This is on my player_BP (vehicle) , the respawn works but if player is moving at all it follows through. I want them dead still (but alive, they don’t die :wink: ) on respawn.

Any ideas?

I have added a disable input, stop movement, stop pathfinding chain. That helps if player hits respawn as they are driving. But if they are in mid air the velocity carries through.

None of these responses seem to answer the OP’s question. You can GET the velocity of an actor, but you can’t SET the velocity. For that, there’s a node called Launch Character.

Obviously, this only works for characters. If you have a non-character that you want to apply a velocity value to, it would depend on what’s being used to move the pawn to begin with. For example, to move non-character pawns you could use either the “Add Local offset” or “Add Torque In Degrees” nodes.

For a character pawn, you’re typically driving the forward movement with the Add Movement input node which is triggered in a tick event via an Input axis value. This makes applying velocity to a character pretty much impossible aside from the Launch Character node.

I know this is too late to help you likely, but for anyone else coming here via search, there’s a node called Stop Movement Immediately that will work for characters. Not sure how you’d do it for a non-character pawn though. Maybe get the current velocity and set that as a variable, and then apply the same amount in a negative direction?

1 Like

It was helpful! Thanks a lot for the late reply, it was exactly what I needed to learn today.

1 Like