How do I animate behavior in a blueprint?

If you’re looking to “animate” it, why not spawn actors and destroy them? Spawn the new block, say per tick, at the new location relative to the last one, and destroy them after they’ve been there for a specific length of time- that way the row “fades”. When you reach the ground- which you could detect by an overlap event when a new actor is spawned (maybe), or just with the height info, the line stops or you make an explosion…

So to test a blueprint I wanted to do something simple, have a “Missile Command” like line come from a point in space (Determined or random) and create cubes to a point on the ground. Which Works as follows :

But the delay doesn’t work for the loop, as only the last cube gets created. Am I approaching this wrong as an Actor Based blueprint ? Should this be a AI type situation ? Or an Anim Blueprint ?
If I take the Delay out it works just fine :frowning: but doesn’t look like a blocky missile from space… it just appears instantly.

So what I’m wondering is if I’m barking up the wrong tree, I don’t want to stop execution, I just want to add another cube / pixel per fraction of a second. Which means I’m looking to multithread, as I don’t want to stop execution of everything else while I wait for the next pixel to draw.

I tried a for loop, and a for each loop as well, and ended up with the while as a last resort figuring that if it didn’t update it would wait… but it typically tells me I have a infinite loop.

This is “Sort of” what it is supposed to looks like, but like I said I can’t seem to get the effect to animate over time.

I suggest using an event for this. Below you have a basic example. You will have to keep track of if you hit something inside the branch, then when you have spawned the block, you must make sure to iterate so the branch stops the event loop when you collide.

(event) SpawnNextBlock → Spawn Block → (branch) ReachedDestination? → Delay → call SpawnNextBlock

This can be used for a lot of things. Especially when you want something to happen in a sequence. I also suggest looking into this with event dispatchers, that’s when real magic happens.

Interesting, that would be cool, but I’d still have the issue that 1 tick is a frame, and I could potentially have hundred of them, I’d like to control how fast / slow they travel, maybe I can read the delta seconds, and drive it off that… I’ll have to see how that works…

My other thought would be to have two blueprints, one that calculates the vector, and the other that builds and fades the geo… since I also need to destroy them, as they’re somehow bogging my machine after 10+ rays… which shouldn’t be that bad… even if they were a couple hundred of them, maybe because they’re dynamically lit…

If you add deltaseconds to deltaseconds per tick you can accurately measure how fast time is passing and accurately spawn a new block on whatever fraction of a second you want.

Not sure about the slow down, but what about instancing? Not something I’ve used, but this would seem like exactly the type of thing it’s for…

So I have the Tick thing working, and it’s pretty sweet, still doesn’t always go from point a to b, I must have some logic error somewhere, but the Performance hit endures. And I looked into getting rid of the instances, and I got stuck here: InstanceMeshComponent
This should work, so after I create them, I wait for time to go by again, or use the delta time, but the thing that fails is the Cast to !. So it can’t remove the instance… any idea what I’m doing wrong ?

P.S. I will try and post the finished solution for others to follow…

I’ve tried the OnTick event, and it works pretty well.

Furthermore I’ve tried to instance geo, due to the performance hit. The issue is instanced geo doesn’t leave a paper trail behind of what was instanced. And adding static mesh components fails when you try and cast it to an Instanced Static Mesh component. So you can’t get rid of it. Removing actors in blueprint seems to be a lot harder than adding them, I suppose I could make them invisible, but that would mean at the end I’d have a bunch of garbage hanging around, and I would imagine some memory bloat.

As soon as I get some of this working, I will Post some blueprint stuff showing how it was done.

Have you added a static mesh or an instance?

Is there a destroy node?

I tried that approach, but getting the return of the AddStaticMesh, and feeding it into a variable, and then using that variable to drive an instance doesn’t work.
StaticMeshComponent Is not Compatible with Instanced Static Mesh Component Reference…
Also Casting it to an instance doesn’t work the cast fails. So I don’t know how that approach works anymore…

Denny I appreciate your example, but there’s a lot of blanks between those → that I’m trying to fill in.

There is a Kill Actor, and remove instance node, but not really a destroy node.

Yes of course, my reply was only to give a crude example on how to handle repeating logic that relies on delays without using tick. It is advised to handle as much as possible of your logic outside the tick, using events, especially if you were to make a game for mobile.