Projectile Movement Component velocity help

I’ve created a Launcher object that launches projectiles. I’ve set up the projectile with a Projectile Movement Component with a defined velocity. The problem is, I would like the launcher to be able to “tell” the projectile what it’s velocity is going to be rather than set that as a constant in the projectile. Ideally the velocity would be best as a variable that can be exposed and set in the launcher. How can I set that up?

Your Projectile Movement Component will be a variable that you can use in Blueprint. First, you’ll want to set your default to 0. Then, in Blueprint, take your Projectile Movement Component(drag the variable in the graph and choose ‘Get’) and from that, you can get or set the velocity. I can get a screenshot for you if needed.

Awesome. Thanks! I tried about 20 different ways, but that one. I was trying to make it overly complex. Now to get the exposed variable from the launcher passed into the projectile…

In you projectile Blueprint, you can add your launcher as a variable and essentially do the same thing to get the variables from it. You’ll probably need to use the “Get All Actors of Class” node to get the ‘living’ launcher actor.

Actually what I did was in the Launcher blueprint, when I spawn the projectile, I immediately call a function in the spawned projectile to set the velocity. Then I pass through the exposed variable in the Launcher. Works perfectly. Thanks for the help!

Another nice way to do this is add a variable for ‘Initial Velocity’, mark it editable, and then check the ‘Expose On Spawn’ option for it. In the Construction Script of your projectile use that variable to set the velocity. Then it will show up as a pin on the Spawn Actor node! I actually just made a video tutorial of this feature, should be up soon.

Good tip! Thank you.

This worked like a charm. The only question I have is how do I set the Projectile Movement Initial velocity to be the Initial Velocity var? Do you have the link to your tutorial?

I’m new to UE4. Thanks.

Construction script set initial speed

Hello, I found out how to set the ProjectileMovement.Initial speed out of the InitialVelocity exposed var. I created this blueprint in the construction script.

Screen Shot 2014-10-27 at 12.02.41 AM.png