I’m trying to create something similar to a trail render but make it so it places trigger boxes instead. An example could be a slug creating a slime trail or a forward fireblast trail that burns the ground infront of the enemy. Each one would have a different effect as well such as slowing the player or dealing damage every few seconds. I know exactly how to set this up just confused how to make the geometry follow a certain path like a trail renderer does. Has anyone attempted this before?
An easy way would be to create some area-geometry for this. Like every 1 second you create and place a slimy path part at the position of the snail. You could give them colliders to check if units are within range and slow them, and it would look like a slimy path that follows the snail.
The only problem here would be to create authentic geometry that looks like a path, it’s easier for the fire as you could use particles and fire is easy tileable
the path would consists of some slimy spots that connect to each other to make it look like a path.
At least this is what I would try before breaking my head about how to create a strechable path-like geometry that follows my snail ^^
I would also suggest spawning slime triggers. Keep them in an array, and allow them to despawn over time by themselves:
function Spawn() {
// spawn slime trigger at snail's position and rotation
yield WaitForSeconds(5);
// despawn
}
Alternatively, you can use Vector3.Distance to make sure you’re far enough from the previous slime to spawn a new one, and despawn the oldest before spawning the next.
I don’t think that would make it look right. With trail render it creates geometry to follow a certain path. With just spawning planes it wouldn’t give the effect I’m looking for.
I’m just curious how trail renderer attaches geometry to follow paths. If I knew how all that worked I could hack it to work with plane triggers most likely o,o
The triggers I was mentioning are for detection only. It’s common practice to separate effects and detection (e.g. a sphere collider around a fire to actually detect when the player enters rather than detecting when each fire particle touches the player). You can just use a standard trail renderer, and place trigger objects along that trail as described. Check out this MeleeWeaponTrail for some source code: http://wiki.unity3d.com/index.php?title=MeleeWeaponTrail
I wasn’t planning on detecting each fire particle as a trigger object. That would be costly. That’s why I said box colliders.I guess I could spawn particles on the ground and then place box colliders along the way, if that’s what you were saying earlier then I guess I misread.
That’s what I was going for. A snail would drop sphere collider triggers (they’re inexpensive, because they only use a point and a radius) and use a trail renderer and/or particles to actually display the effect. The link I posted contains source code for generating a trail mesh if you need to put together something else.
Don’t worry I just tried a box collider and particle system and it looks great. Not exactly what I was going to do but the trail renderer seems rather complex but how I set up everything it will work just fine. Thanks for the advice.