how to make a wind gun
Fairly new to unreal and not too good with blueprints yet. Does anybody know the blueprint for making a gun that does not fire anything that's physical but simply pushes back objects slowly like its a powerful fan ?
asked Nov 30 '14 at 12:15 PM in Blueprint Scripting
I started working on it so here's what I did. It's far from perfect, but you can get started on it (if you haven't made it yourself yet, it's been almost a year). I also have different versions, I'll get back to that later on.
So for the first step, choose a button that will activate your wind gun, and create an event for it ("L" in my case). We need to apply force continuously, like wind does, and I achieved it by creating a timer, that will apply the force every 0.1 seconds, so it's works almost the same as if it was applied continuously. (This method may not be the best to achieve continuity, but I'm also a beginner, so this is what I could do.)
We also need to disable the timer, thus deactivating the wind gun. So as long as you press "L", your wind blows.
Now this timer calls a function called "WindGun" (in my case, you can name it sth else) every 0.1 seconds, so now we have to set up the function to apply force in a given direction. So now create a new function in the "My Blueprint" tab, and let's name it "WindGun" for now.
In the function window, drag off the execution pin and create a "LineTraceForObjects". Do it so you get the same result as on the image. This way, you "cast" your wind forward (the length of how far your wind blows objects in its was is defined in the "Wind distance" variable (I set it to 5000 I think). In the "Objects to Push Away" variable you can set what kind of objects you want to be affected by your wind. (I set it only to "Physicsbody".)
Again, do it so you get the same result. Here you set that if there is an object to affect in the way of your wind, you apply force to it. The force is defined by "Wind Force" variable. (set it to about 600.000 - 1.000.000 for starters)
And that's it. What you may want to experiment with is the radius of the wind, i.e. how you set up tracing. Right now, since it's a linetrace, the wind only works in that single line. If you want to make it bigger and have some radius to it, you should use for example capsuletrace instead. Then the wind affects object in the radius of the capsule that you cast forward.
Anyway, I think it's enough to get you started. If you have any questions about any part, feel free to ask.
answered Oct 28 '15 at 08:28 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here