How To Make Something Like This Randomly In Blueprint?

How To Make Something Like This Randomly In Blueprint?

I implemented something similar in one of my projects. The best method I found was to use a *Random Unit Vector in Cone. *

  • determine the general direction of the spline flow
  • in a loop, generate points using the above & *Random Unit Vector in Cone, *and multiply the result by the desired distance between points
  • add the result to the previous point

For something as chaotic as shown in the pic, the half cone would need to be 45 degrees and have a min clamp or at least some bias towards the extreme allowed angles.

Here’s an example:

edit: All variables are local to the *Construction Script *and the Distance Between Points is set to 100. The second loop averages the locations so the spline component’s points end up centred - this step is optional, of course.


It can be easily fleshed out with extra features, accumulating the overall drift as you step through the loop will produce more intricate and interesting paths.

2 Likes

Million thanks :slight_smile: How would you make it more kind of horizontal? Because sometimes it’s almost vertical and that’s not wanted.

The *General Direction *is using a random vector. Set it to 1,0,0 instead - this will make it grow along X, or 0,1,0 - for Y; 0,0,1 would make it grow vertically.

This is going to sound like a crazy question but I’m trying this method to create random roads and i cant seem to add the mesh in to the points. My goal is to use these random spline points to generate a road, and use the road mesh to initiate an actor to spawn (houses)

Either look up tutorials or post the script that is not working correctly.

So the script runs fine, i just need help on populating the spline points with a mesh. Iv looked at many tutorials but the script for this isnt as straight forward. I will attach photos


You said you looked at tutorials but you’re adding SMCs without even trying to adjust their start / end and tangents.

Yes that was just an example of my ignorance on it haha. Iv gotten the ability to produce actors based on a mesh location. Iv created spline mesh blueprints that allow you to build using the spline meshes. But unfortunately many tutorials are pretty specific to the problem and im still too green to know what i dont know. And of course theres value in learning it all from the ground up but I’m mostly doing environment design. I didnt know if there was a quick way to add the mesh like you can in the landscape spline editor. Iv been grinding for a year and figured most everything out but this is the first time iv actually had to reach out for help. Even a couple sentences in the right direction is very valuable to me as a beginner and hobbyist. Even letting me know if its too complicated or if its a quick easy add or honestly any information goes a long way in helping.

Once the spline has been generated:

Run the below script where the arrows points above:


If in doubt, keep trying those keywords:

https://www.youtube.com/results?search_query=ue4+spline+mesh+component+road


If it still does not work, do post the updated script.

image

And they said game-dev would be fun! shakes fist @Epic

This is great thanks, I am trying to create the same thing for my AI to move along randomly. I am learning blueprints as I go through tutorials. Now I had to try to guess the variables types in the script :slight_smile: