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 to play sounds when overlapping foliage

I'm trying to figure out how to play specific sound effects when I overlap grass, weeds and bushes in my game.

I'm able to get overlap events for the InstancedFoliageActor, but that's for the entire collection of foliage in the world, so it doesn't seem to allow me to play unique sounds for different types of foliage.

Is there a way to do this in the engine out of the box? I'm using 4.8 preview 3.

Thanks!

Product Version: UE 4.8 Preview
Tags:
more ▼

asked May 21 '15 at 06:30 AM in Using UE4

avatar image

JigglyToes
226 13 14 21

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

1 answer: sort voted first

Hey JigglyToes,

Have you considered using trigger boxes in the foliage area? Here is a screenshot of a trigger box blueprint which when it's stepped on, the character is lit up in flames and there is a burning noise, once 5 seconds has passed, the flames disappear as long as you're off of the trigger.

Trigger

So, if you have different types of foliage, you can set up trigger boxes around your map where that foliage is and it'll be connected to the different sounds you're wanting for each type of plant.

Let me know if you have any further questions, I'll be more than happy to investigate this further for you. :)

trigger.jpg (156.7 kB)
more ▼

answered May 21 '15 at 09:40 PM

avatar image JigglyToes May 21 '15 at 11:03 PM

Hi Samantha,

That could work in small levels, but we'll be placing thousands and thousands of them in our world, which makes it very impractical to manually and accurately place triggers on each one of them, especially if we iterate on the layout of our levels.

It would be much better if I could somehow tag each type of foliage with a type, then have a piece of code or a blueprint play a sound based on the type.

avatar image Samantha Sutton ♦♦ STAFF May 22 '15 at 03:08 PM

Hey JigglyToes,

If you have a specific type of grass actor that you're using and you're not using that anywhere else, you could simply set up an object overlap event with a custom collision (or object) channel (foliage). Once you set that up, every time the player overlaps an object with the foliage collision it'll play a sound. Make sure you set it up within the player character.

If you have any further questions, please let us know. Enjoy your weekend! :)

avatar image HuntaKiller Sep 16 '15 at 02:46 AM

except that blueprints cannot be used with the foliage tool, only static meshes, which you can't hook up events too. and my character does not seem to recognize events through overlapping with foliage objects

avatar image Samantha Sutton ♦♦ STAFF Sep 17 '15 at 06:41 PM

Hey HuntaKiller,

The foliage tool doesn't work with blueprints like static meshes do. If you're having trouble with getting your foliage and blueprints to match up, please submit a new post to AnswerHub and describe exactly what's happening. Please do not forget to include a sample project or uploaded photos of your blueprints so we can try to replicate and resolve the issue.

Thank you! :)

avatar image HuntaKiller Dec 12 '16 at 12:28 AM

I know the foliage/dynamic-foliage tool only works. I'm referring to what you suggested, "you could simply set up an object overlap event with a custom collision (or object) channel (foliage)", how do I do that if you can't add any functionality to foliage. Currently a trace CAN detect foliage instances but how do you know to start that trace if the overlap event doesn't fire. You would have to do a trace around the player on tick, which is an expensive replacement for an overlap event.

(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