Hey guys, hopefully some of the more tech artist minded people here can help out with this one.
I'm trying to make a procedural fence I can use for one of my projects. I made an example video and sudo blue prints of how I'd imagine this would work, but I'm having trouble figuring exact which nodes I'd use, and how to setup a proper looping function.
Also is it possible to bake down a mesh created from blue print construction scripts into a static asset? Because I'd only need the procedural generation during iteration and blocking out the scene.
So here's the examples of what I'd like to do exactly.
http://youtube.com/watch?v=lKWV3qfNTHQThe furthest I've gotten on my own is placing a post every 500 cm at where it intersects with the terrain, but that's lacking pretty much everything I want to do with this.
In the future I want to build in parameters that allow the fence to curve a few degrees every post, allow you to ease in and out of curves, have drop down menus to pick the starting an ending pieces, add forward/backwards sagging, pick rails/posts out of a pool of assets and apply random 180 rotations and flipping on 2 axis, and having a rare pool of assets for damaged or more unique details.
The biggest issue I'm facing at the moment is how to do the arc trace, because I'm not seeing mentions of anything like it in tutorials or documentation.
Then the next biggest issue I have is trying to make this whole thing loop x number of times.
Replies
If you want the mesh to change randomly you could just pull a selection from an array.
That's how I would botch it anyway.
have a spline - not spline mesh. On construction script, check the length of the spline. You need this because youll want to evenly distribute the poles along the spline. This will also tell you how many poles you can have. Basically any divider of the length. You can also floor\ceil\round the length to get a whole number. So then, put a for or for each loop depending on how you want it... Then on the loop update, do a line trace that goes straight downwards so you trace the surface of the terrain. On each loop, youd get location along the spline at distance and that distance would depend on the index of the loop multiplied by the desired distance of the poles so you can have even steps...on the inpact point, add an instance to an instanced static mesh (instances are free you can have thousands without any impact on the performance...) . You can do a similar thing to place the horizontal planks as well. Let me know how it goes, good luck!
In the worst case I can make a new one and I can show you.
It's possible and even advised for complex blueprint to save computations in a shipping game (especially on heavily complex blueprint, like tree generation and so on). See : https://docs.unrealengine.com/latest/INT/Support/Builds/ReleaseNotes/2015/4_7/
Would this logic work? Do a linetrace forward (in the turtle moving direction) and check if it hit something. Then if it does, set a bool that it's on a surface, and adjust the position to that impact point and adjust the direction. Then in the next forward move (now parallel with the surface it hit) still do a normal trace forward and if not hitting anything, do a trace downwards towards the surface and if it hits, adjust the position and surface rotation.
Im thinking this must be quite similar to those blueprints where you want your character to walk on curved surfaces...
Export the terrain to Max
Conform a spline to the terrain
Use path deform or similar to instance the fence section along the spline
Export/Import a single fence section to UE
Select all fence sections in Max and use Tom Shannon's script to copy the selected objects' transforms and names to clipboard
Back in UE press CTRL+V
Proxy cubes will be created at the exact locations of the fence sections
Swap out the single fence section SM that you imported earlier
Your entire fence as it was created/located in Max will be instanced in place of the proxy cubes.
If you don't use Max then sorry for wasting your time.