Change projectile speed on spawn

I’m trying to make a ‘bow and arrow’ type projectile. Where you charge the projectile speed before it’s spawned. Having issues trying to set the initial projectile speed after it’s been spawned.

Hello,

What you can do for your projectile blueprint is add a float variable and check the box for Expose on Spawn (it will also need to be Editable), in this example I’ll call it Projectile Speed. In your projectile blueprint’s construction script, you can use a reference to your Projectile Movement component to call and set your Initial Speed using the Projectile Speed float you just created:

Now, in your Character blueprint (or wherever you are spawning this projectile) when you spawn your projectile, your Projectile Speed float will be available for you to pass in a value, which it will automatically set when created (spawned):

Hope this helps you out!

-Steve

3 Likes

Great, thanks a ton! :slight_smile:

Trying to do the same thing with the default FPS Blueprint MyProjectile and I don’t see any “Initial Speed” or “Projectile Movement” bits in Blueprints. Where are they? Code completion turns up nada. Version 4.1.0 if it helps.

You need to drag the projectile component into the blueprint then you can create a node to set the initial speed.

Hi I’m wondering, for some reason if I plug a variable into the make literal float, it doesn’t work. I have a value that changes to plug into the projectile speed so I need to use a variable, but it seems to stick to some flat value.

If you mean your variable is in the character class (or wherever the proj is spawning) then I don’t believe you need the Make Literal, but would connect the variable reference directly to the Projectile Speed pin of Spawn Actor.

how can I change initial speed every time in press “H” ?