I’m struggling to make my beam weapon work like it should. The beam particle is ready - it can go from one actor to another, if I want it to. It becomes more complicated, when I want it to go from my characters gun, to the point I’m pointing at. When using the blueprint I created, the beam comes out of the character and goes straight forward. It doesn’t go up and down and isn’t attached to the gun. Take a look at the screenshots for more info.
I’m a beginner when it comes to blueprints, so forgive me, if I’m doing some rookie mistakes. I’m asking for a solution, but an explanation would be very cool as well.
As you can see, the beam is supposed to go from the billboard I set up right in front of the gun (probably a bad idea, but I know no other way around this) and it’s supossed to go where you’re pointing at (just like the traces, that work). How do I deal with this?
Ah actually not that big of a mistake. A really small one quite honestly but one which is not that obvious.
You are setting a location where the beam starts and then simply add a distance.
This only works if you use the camera as spawn since the location you spawned your emitter is not in the middle of your camera and if you simply add a distance it will have the same offset your camera has in relation to your emitter.
To solve that simply remove the straight distance and do a trace for your camera. Whatever it hits is the location you want the beam target point to be so it will be in the middle of your screen. If it is further than your max range simply get the vector between that point and your current camera location, cut it at your max range and put the beam target range there.
Thanks for the reply!
Sadly it still doesn’'t work. Or at least what I changed, trying to follow your advise, doesn’t work. The effect is exactly the same as before. I probably didn’t understand your answer correctly, so I’m just going to attach a screenshot of the modified blueprint. I would be grateful if you’d send me a reply image, with some corrections on it, if needed. Otherwise I would appreciate some further advise to get this going.
It’s not quite that easy.
For the target point you will need the camera → get the world rotation → get forward vector which will get you the vector you need. Multiply it by the distance you want and set the target point there.
If you want it to stop at any environment do a trace between those two points and use the hit location as your target instead.
And for the spawn point of the beam. Take a look at the first person example. They do exactly that. Spawn the projectile at the end of the weapon.
The good news is that the beam is now shooting right out of the guns’ barrel (using “relative transform” of the beam particle).
The bad news is that the beam is still not moving along, when looking up or down and it doesn’t go to the desired target. I’m sure somethings wrong with the way I set up the particle. I also forgot to mention - the beam always ends after a certain length - the one I set up in the particle editor. Is this how it’s supposed to be?
On the following screenshots you can see two methods (both are not working). On the first I’m using your method (at least I think it is the one you described ). While on the other I simply set the source and target as a vector (0). It’s value is 0, 0, 0… and the beam is working exactly the same way as before. Aren’t we missing something important here? I feel like something’s wrong beside the blueprint. And what’s the point of setting the source point, when we have the beam set up in the components panel of the actor anyway? I’m sorry, but I simply don’t get it
Ok if I go through this again (not only looking at the positioning) this seems rather odd.
You have your particle system in your components and use this one to define the points but after that you spawn everything in if the “Event Fire” is called meaning you are not actually using it (at least as far as I can see it).
You spawn an emitter and add the particle system at the very end. If your particlesystem1 is not active at the beginning you have to activate it to work at all.
Try to either only use one static system or only spawn in a system and from then on only use that one as variable.
This also might explain why it only works for a certain distance and it would certainly explain why it does not follow up and down.
After hours of testing, experimenting and playing around I finally managed to make a functional beam weapon! It took a lot of work but I’m happy to get one step further in developing my game and I hope that the attached pictures it will be of use to somebody, someday
And thank you for the good will, Erasio!
PS: The particle has it’s source and target point “user set”
Thanks very much for documenting your solution. It’s immensely helpful. I had a lot of trouble finding good information about this topic and your post covers it really nicely.
Here is how I do a Beam Weapon (Tutorial) >>Twitch
Thank you, that’s very useful! I wish I had such a tutorial at the time I was having problems with my system
Can someone make another tutorial video? Because when I follow the link it says the video doesn’t exist, if anyone does make another one I would greatly appreciate it, thank you.