How can I create a projectile in Unreal Engine where the user can adjust the launch force before firing (e.g., using a slider or a variable)?

I want to use blueprints for this.

Hey @Jisicoo! Welcome to the forums!

Start out with making just a regular projectile - there are tons and tons of tutorials on that.

For the specific need here- you want to:

On the Projectile:

  1. Make an “input speed” float variable.
  2. Make “InputSpeed” public and Expose on spawn. This allows you to input the float from another blueprint when the projectile spawns before Construction.
  3. On your Construction Graph do “Get ProjectileMovementComponent ->Set Initial Speed” and use the Input speed to set it using “Get InputSpeed”.

Now on wherever you’re adjusting this from:

  1. However you want to set the variable, do that. There are lots of very short tutorials on things like how to set a variable using UMG or by interacting with the environment, or simply using the keyboard/mouse/controller.
  2. Now, when you go to Spawn Actor for the Projectile, plug in your SPEED variable here into the “InputSpeed” variable that should show up when you tell it which actor class you want to spawn.

That should be it! Hope that helps!