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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

ue4 line trace shotgun?

Is there a way to do this?

Product Version: Not Selected
more ▼

asked Mar 22 '15 at 06:04 PM in Blueprint Scripting

avatar image

10 6 7 11

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

2 answers: sort voted first

Hey there!

I just finished building this exact feature in my super comprehensive Gun class system. I stumbled across your post while looking up how to do it myself. Ended up having to design one.

(I may release my gun system on the Marketplace once it's more polished.)

Anyway, I have the solution.

It's pretty straightforward once you know what to do. I'll give you my blueprint method, and I'm sure you can figure out where to hook it in if you're dabbling in making guns fire already.

See attached image. Hope that helps!alt text

hitscan_shotgun.png (368.9 kB)
more ▼

answered Mar 31 '15 at 08:35 PM

avatar image

291 8 109 34

avatar image Zaggoth Mar 31 '15 at 08:41 PM

Addendum: If you are not using a separate gun class (if you're doing this right on the player character) then you don't need to use a Cast To node for your character to get his camera, world location, etc. It should just be available under Context Sensitive in that case.

avatar image ecortez May 10 '15 at 12:53 AM

This works really well, but I am having an issue with a spawn emitter erroneously being created. Maybe it's because I used a line trace for objects, but any time I fired, a spawn emitter was created at either the previous hit location or a random default location.

To keep this from happening, I used an Is Valid check using the Hit Actor pin from the Break Hit Result info. Hopefully if anyone else comes across this and has the same issue, this might help.

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

Here is a way I found useful. The "Projectile Spawn Loc 2 Right" is just an Arrow component so I know where to start the trace (at the end of the barrel of my weapon).

You could add a variable called "SpreadAmount" and then drag that to the Min and Max pins of the Random Float in Range, just do Min * -1 to get the negative range.

alt text

more ▼

answered Apr 07 '18 at 08:48 PM

avatar image

69 8 9 12

avatar image CODE REDBALLG Jan 14 '19 at 05:29 AM

Thanks so much for this!

(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