Projectile questions

Hey everyone, I have a question about projectile speeds and how to set up the blueprints for a mechanic I want to make. I want to have particular objects when they are hit by a projectile increase the speed of said projectile. I would also like to set up a system that if multiple objects are hit back to back the speed will increase in increments ( 1 object - 1.15, 2 objects 1.35, 3 objects - 1.5, etc.) I would appreciate any guidance or links to tutorials that could help me with this!

The approach I would take in this matter would be as following

  1. Create an actor that is projectile.
  2. This projectile can move at a certain speed per frame. Basically after it is spawned, you use the event “Set Timer By Event”. This event will be looping and it uses “Set Actor Location” event every time the event is called. You can define how many frame per second it runs and how many units per frame does it move as variables. You can also add the speed multiplier to change that
  3. On the projectile you want a box/sphere collision. This collision tests if the actor that entered is of class projectile. “Cast to Projectile” will need to be done for this. If it is you change the speed multiplier.

An alternate approach will have to do with this tutorial though this is physics based and it might not be best one for you. Though still take a look:

I hope that helps. Though feel free to ask questions and I will help you expand on things you are confused with.

Thank you very much! I’m gonna give your recommendation a try first to see if I can get it to work.

Hey zer0chi, I’m having a bit of trouble understanding the blueprint layout if you have time would you be willing to post an example for me?

So I did some implementation to get you started out and help you understand.

  1. First I created A Bullet BP. This is the projectile that has to be spawned. I created a few variables that are required for movement and some code.
  • Forward Vector - Direction you want projectile to go into
  • FPS - How many frames per second you want timer to run at. I like timers more than tick
  • Units per Second - Unit in unreal engine is centimeter. So this defines how many centimeter per second projectile would move if speed was 1.
  • Speed - Multiple for units per second.

After that I implemented a basic timer. Image below:

  1. So every time a projectile touches another projectile we want to change the speed of projectile. I added sphere collision for that and use “Begin Overlap Event” to trigger it. When project touches another project I add 2 to speed. Mostly reason being I want to show impact. You can add any other logic you want there as well.

  1. Since I don’t have a character, I created another actor called Gun. This will be responsible for spawning the project. It’s pretty simple. It has a box to represent it and an arrow to decide direction. I create a custom event “SpawnBullet” that spawns actor, feeds to forward vector, units per second, speed, fps. For varied speed I just created a bool to switch between 2 speeds so collision can happen.

    Screenshot - 2fe954d04313792f2b97978989ffe7c0 - Gyazo

  2. Finally I place the Gun in Level. In level blueprint I take its reference. Take ‘1’ key as input and call the spawnbullet event.

RESULT: Screen capture - f690e4bf30d28bfaf0977a4c935080e6 - Gyazo

Hope this helps