Skip Mesh during Procedural Generation

Hi there,

In my blueprint I want to only draw the meshes that are actually close enough to the player character, however I fail to understand how I can make the engine actually skip a mesh instance during the procedural generation process. Here are the nodes I am using so far:

As you can see in the folder “Calculate Player-Mesh Distance” I am testing at the end if the distance is too high or not and whether the current mesh should be added to the scene or not, which is what the branch in the red folder should acomplish… but I can’t get it to work…

I’m sure it is a simple thing but please can anyone help? How do I tell the engine that it needs to skip the creation of those meshes that are too far away, based on the calculations below?

Thanks a lot!

when you run your loop through your branch condition check, you can get the location of the mesh to be generated minus the player character’s location. then with the resulting vector, drag out the pin and ‘get vector length’ (which will always be positive, so you won’t need to break any vector structs for absolute values). then compare that vector length with your desired distance check float variable to return true or false for your branch.

Sounds cool, thanks… I’m not sure how to do it yet but I’ll try it out. If you would be super kind you could show me your idea in nodes that way I would come to the solution much quicker. In any case, when it works you’ll get my up vote, thanks!

Here’s one example of the case. There’s a billboard component which just stores a location. In the constructor, I’ve set the location of that billboard to vector TargetLoc which is public, and has a 3d widget (checkbox in the details panel of this variable). Then the proc gen loop starts. Before an instance is placed, a distance comparison is checked against the location of the billboard to determine whether or not an instance should be added. This method allows you to drag around the billboard creating a pocket of emptiness where you don’t want any meshes generated.

Thanks a lot. At the moment I’ve found out that I can get the distance culling effect automatically when using Hierarchical Instanced Static Mesh, though the culling is dependent on the actual mesh size rather than an editable value. In any case I want to have my procedural generation some what different than with this kind of culling, so that tiles that are further away have no collision data and are replaced with a less complex mesh as well as lesser texture resolution in order to have the pest performance possible. So your input is still very appreciated, thanks!