x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I make my beam weapon work properly?

Hello,

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.

alt text

alt text

alt text

alt text

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?

Product Version: Not Selected
Tags:
bp1.png (470.7 kB)
bp2.png (367.2 kB)
character.png (820.1 kB)
game.png (1.1 MB)
more ▼

asked Oct 05 '14 at 05:12 PM in Blueprint Scripting

avatar image

Bproof
85 14 16 95

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

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!

alt text

alt text

alt text

alt text

alt text

PS: The particle has it's source and target point "user set"

Cheers, Bproof

more ▼

answered Nov 11 '14 at 04:57 PM

avatar image

Bproof
85 14 16 95

avatar image Bproof Nov 11 '14 at 04:58 PM

Result: alt text

bez tytułu.png (1.7 MB)
avatar image Phasechange Sep 28 '15 at 12:22 PM

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.

avatar image Bproof Sep 29 '15 at 05:27 PM

I'm glad I could help :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Oct 06 '14 at 12:50 AM

avatar image

Erasio
6k 291 86 293

avatar image Bproof Oct 06 '14 at 06:04 PM

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.

alt text

bp.png (257.8 kB)
avatar image Erasio Oct 06 '14 at 08:12 PM

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.

avatar image Bproof Oct 06 '14 at 09:22 PM

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 :P ). 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 :(

alt text

alt text

alt text

bp1.png (474.4 kB)
bp2.png (404.3 kB)
bp3.png (345.5 kB)
avatar image Erasio Oct 06 '14 at 10:03 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Here is how I do a Beam Weapon (Tutorial) >>https://www.twitch.tv/iamjohngalt75/v/69851397

more ▼

answered Jun 01 '16 at 05:52 AM

avatar image

iamjustagamer75
0 1

avatar image Bproof Jun 01 '16 at 11:42 AM

Thank you, that's very useful! I wish I had such a tutorial at the time I was having problems with my system :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Dec 07 '16 at 03:50 AM

avatar image

Chip128434
1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question