Draw a curved line between two random points?

Hey all! I have a setup that spawns random tiles in a grid. I’m wondering how I would then get two random points on the landscape, draw a randomly curved line. Then do a sphere trace between them deleting any tiles in the way. Then later I’ll spawn different tiles in the now empty spots on the grid.

So basically:

  1. Get point “A”.
  2. Get point “B”.
  3. Draw random, curved line between them.
  4. Sphere trace along line.
  5. Save HISM’s location data to an array.
  6. Delete HISMs.
  7. Pull empty spot’s data and populate with new tiles.

Any help appreciated.

You’d have to use a mathematical function with a randomized variable to get the curved lines. You can then use a collision component on the line and use “Get Overlapping Actors” as an alternative to Sphere trace, then delete the actors that you detect.

Okay so my world is a grid, I’m getting two random instances of the hisms that spawn and drawing a spline between them.

I can’t seem to get it to remove the plane hisms that it’s overlapping and it seems you can only set the beginning and end points. Hmm…

How would I get a volume along the spline?

What are you using to delete the plane hisms?

On begin overlap

If you’re able to get a volume along the spline, you can use “Get Overlapping Actors” to grab an array of tiles inbetween the two points, then delete each tile in the array.

Seems like that’d be difficult. Going back to sphere tracing, you could try something like this that I threw together:

Though you’d likely have to adjust the number of spline nodes you create and check for duplicates.

Is there a way to add more points on the spline so it curves? Then sphere trace along that?

Cause won’t a sphere trace go right to the end vs a spline following it’s “path”

Okay so for some reason when I add points to the spline in construction script it has some extra(I’m assuming it starts with some). So I then clear the spline points and set three points to random tile locations. That seems to work but for some reason the sphere trace doesn’t want to fire? It’s set up exactly like yours.

The actors to be destroyed are HISM Instances so I think that is causing some problems. And for some reason the sphere trace is running multiple times?

The trace is inside the for-loop, so it’ll run for however many spline nodes there are.

You’ll probably want to adjust the “Remove Instance” part at the end, as the array index and instance index probably aren’t interacting the way you think they are.

Is there a way I can hook the sphere trace up to properly match the spline without running a whole bunch of extra times?