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 do I get specific Foliage Types out of an overlap?

I've just switched my game from a hand painted foliage system to a fully procedurally placed foliage system (using the procedural foliage volume). However one specific system, even though it works as intended, does more than it is supposed to do now.

The player is allowed to place buildings in the world and when a building passes all collision tests with other buildings, tress, rocks etc. it will be placed down and all the grass in a specific area (a collision sphere around the building) is being deleted. This still works, but since tress, rocks etc. are part of the same foliage system now (they weren't before) they will be deleted to.

So I somehow need to collect all the foliage that is colliding with my collision sphere and then get e.g. the foliage type to decide wether or not to delete the object or not. I've attached an image of the current system that just gets all the foliage elements and delets them no matter what. Does anybody have an idea how to easily expand this system to check for specific foliage types? So basically just collect the grass types, flowers etc. but not the trees, rocks etc.

edit: you can ignore the return node, itshould be connected with the completed port of the foreach loop. alt text

Product Version: UE 4.18
detectfoliage.jpg (222.8 kB)
more ▼

asked Dec 03 '18 at 02:45 PM in Using UE4

avatar image

1 3 1 4

avatar image Glomby Dec 05 '18 at 01:19 PM

One update. So I was able to almost do what I wanna do here. Since I can get the instanced meshes I can get their materials. So by comparing the materials I can find out which object is just a type of grass or a tree, rock etc. and only delete the ones I want. However I have to update the list of possible materials whenever I wanna add something new to my Foliage Spawner.

If I could find out which material type something uses this would be much easier, since I could make all the grass be a child of the same material type or something like that.

alt text

detectfoliage2.jpg (253.2 kB)
avatar image King Mango Dec 05 '18 at 06:17 PM

can you use naming conventions to pass through an "if" statement to toggle eligibility? e.g. Make sure all your grass meshes have "grass" in the name then use that string as a filter?

avatar image Glomby Dec 06 '18 at 03:11 PM

Yes you are right. I can just use the Materials to look for a certain prefix. I just tried it with my two grass materials and it works perfectly. Both are named differently currently but I will use the same prefix for all the stuff I'm gonna add to the procedural foliage spawner in the future. I feel like this method also doesn't have a lot of overhead to it, so it should work nicely.

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

1 answer: sort voted first

This implementation is a quick test based on King Mango's suggestion. It works nicely. Like now I'm checking for my two specific grass types but I will change it so all the grass has the exact same prefix in the future. This way I can add whatever I want to the procedural foliage spawner and have it either be removable or not depending on the prefix of the material instance.

alt text

detectfoliage3.jpg (324.3 kB)
more ▼

answered Dec 06 '18 at 03:14 PM

avatar image

1 3 1 4

(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