Hey all. I’m trying to figure out a way to draw a circle “border” around an actor. Imagine like the borders around cities in civ.
So when a player places down a building their border will grow to the new building and that would be their “border” my initial thought was to just get the bound of an object and place a simple decal down scaled to fit that. But I’m wondering if there’s a better way to do it? I though about a spline mesh that’s just a line with a simple material or a beam particle but I don’t know how I could continually add point/take away to build on itself and make it grow in a circleish shape.
I know this is a pretty involved question really just looking for some tips on the best way to approach this.
Edit: Okay so the world is made of tiles, I figured the best way to do this would be to draw a multisphere trace around the city any tiles that are hit get their origin location added to a spline. Is it possible to just get the edges of the sphere trace?
Maybe two? One bigger and one slightly smaller if they are hit by both do nothing if they are only hit by the big one do something?
Here’s something I threw together real quick, I’m trying to get the hit tiles between those two traces, then use their location for the spline points.
That’s all done with two multisphere traces. Since they are hism I have to do a cast and add instance world transform to an array I break it for vector. On the output I’m just for looping and adding an instance of a cube.
The trace doesn’t seem to be able to draw a circle, increasing the error tolerance just makes a square of empty, so the corners are cut off and the 4 edges across from each other are like 3 thick.
a simple decal down scaled to fit
that. But I’m wondering if there’s a
better way to do it?
That would work well, even if the underlying surface is uneven.
I though about a spline mesh that’s
just a line with a simple material
[…] and make it grow in a circleish
shape.
Have a look here:
I know it’s 3.5 year old but I still use it these days, a slightly modified version.
edit: also, I think Rama’s Victory plugin has drawing functions exposed - they’re based on the debug draw shapes that are already in the engine. Unlike the engine’s debug, the plugin’s nodes do work in the packaged.
You could also use a widget component aligned with the ground - this would give you a lot of flexibility since now you’d have access to both the material (optionally) and the widget animations. The downside - not everyone likes working with widgets ;p
Pretty sure you could do it with particles, maybe with ribbons but I’m not good with particles so can’t really suggest anything tangible here.
For something really fancy looking, you could combine one of the above methods with particles. I think decal is the most natural option here.
Hmm well it doesn’t have to be super fancy looking. Ideally at the end it would auto generate around player structures most likely just a basic circle. And then allow the player to “draw/erase” the borders if they want.
I figured a decal would be easiest as I could just literally do a circle scale it up to fit the bounds of things. But then the problem becomes how do you draw/erase a decal? Cause in civ not every border is a perfect circle and if the player wants to draw there border it wouldn’t always be a circle.
I figured spline might be good somehow have it deform/form around and then draw a line along it. I’ll test the decals in the morning and update this. Thanks!
If you need it deform to a non-circular shape then opt for a spline. A decal will not cut it.
Yet another solution is to use post-process:
This way you can keep the border as a geometric shape and have it highlighted. Since geometry is easy to manipulate, extending the border is any direction / by shape should be fairly easy.
Okay so the world is made of tiles, I figured the best way to do this would be to draw a multisphere trace around the city any tiles that are hit get their origin location added to a spline. Is it possible to just get the edges of the sphere trace?
Maybe two? One bigger and one slightly smaller if they are hit by both do nothing if they are only hit by the big one do something?
Here’s something I threw together real quick, I’m trying to get the hit tiles between those two traces, then use their location for the spline points.
That’s all done with two multisphere traces. Since they are hism I have to do a cast and add instance world transform to an array I break it for vector. On the output I’m just for looping and adding an instance of a cube.
The trace doesn’t seem to be able to draw a circle, increasing the error tolerance just makes a square of empty, so the corners are cut off and the 4 edges across from each other are like 3 thick.
Edit: Didn’t realize images were broke, here’s a link to the code.