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"

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. 

How could I spawn different emitters based on material?

Hey guys, I am creating a first person shooter and I was wondering if there would be a way to spawn different emitters depending on the objects that I shoot? I am using a simple line trace for my bullets and I have emitters set up correctly to spawn on location of hit, but as of now I can only assign 1 emitter to spawn. Any help would be appreciated! Thanks a lot!

Product Version: UE 4.10
Tags:
more ▼

asked Mar 07 '16 at 06:14 PM in Blueprint Scripting

avatar image

Anaklosmos
170 35 29 54

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

1 answer: sort voted first

This is something that exists pretty much exactly how you want it.

I'm assuming you have a medium amount of particle systems for different types of objects (aka wood, metal, stone).

In that case you can use a Physical Material!

A physical material contains a bit of information regarding some physics properties (friction, destruction threshold (if you use it on a destructible), etc.). You can add a physics material onto any material to give it those properties. If you give them a name for each type of surface you want (again wood, metal, stone, etc) you can then on hit check which physics material is applied to the material you shot and based on that spawn an emitter of the appropriate type.

It still needs a function like "GetEmitter" where you enter a physics material, then check which one it is and return an Emitter Class but at least it removes the effort it'd take to distinguish between all materials and reduces it to only make it necessary to distinguish between each type of surface you want.

Cheers!

more ▼

answered Mar 07 '16 at 06:26 PM

avatar image

Erasio
5.9k 291 86 293

avatar image Anaklosmos Mar 29 '16 at 04:22 AM

Could you possibly post a screenshot showing the setup you would do after the line trace? I can't figure out how to get the physics material of the actor that I shoot.

avatar image Erasio Mar 29 '16 at 05:06 AM

The result of your trace will be a hit result. Break that and the physics material will be one of the variables contained by the struct "Hit Result".

avatar image Anaklosmos Mar 29 '16 at 05:33 AM

Alright I see that. So I need to create a function? I'm not entirely sure how to set that up, as I have never used functions before. What do I add inside the function and how do I call the function into my event graph?

avatar image Erasio Mar 29 '16 at 05:43 AM

...maybe you want to start with something simpler, closer to a tutorial if you are completely new?

I don't mind helping but I'm not here to develop features for others or spoon-feed exact setups.

Depending on how you shoot either you trace already in which case you hook it up to your shoot button -> trace -> use hit result.

Or you have a projectile in which case you want to have the setup shoot button -> spawn projectile -> when it hits ("Event Hit") -> Use the hit result.

avatar image Anaklosmos Mar 29 '16 at 04:33 PM

Alright, I found a tutorial that showed me how to do this. Thanks for the help! I'll post the link to the video below in case anybody else needs to know how to do this!

https://www.youtube.com/watch?v=9PNcnF-2f0g

(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