Array Problems

Dear community,

I am having trouble with two mechanism I built with Blueprints that sadly don’t work together:
I have an array of 7 3D cubes made out of the same blueprint.

The first blueprint creates a light chase, triggering events (for light emission) at the first array element, then goes to the next with a delay, creating a light chase effect…and goes back to index 0
The second blueprint, spawns new 3D cubes in the horizon when the camera moves forward, and destroys the ones the camera has passed (an event triggered by an overlap)

Each blueprint by itself works, if I only let the light chase run, it works. If I only let the spawning blueprint run - it works. But together, the spawning works but the light chase won’t + I get an error.

I tried various techniques and sadly no luck.

Any ideas?

Thanks in advance!

Elad



why not have the light chase happen in the material and not switch meshes?

I am not sure how to do that. Would this method keep the delay consistent between the meshes correctly when spawning new meshes ?

Right now I am turning the materials on/off from within the blueprint
and the main light chase event triggers them with delay between the meshes.

This is what the light chase does: https://www…com/watch?v=K-HWwcA6iVM&feature=youtu.be&ab_channel=EladMagdasi
It works great until I activate the camera forward-movement which triggers the spawning blueprints and then the array somehow gets broken but idk why

it looks like you’re always inserting into the index of 0
and deleting only index 0…

Every mesh instance has a box collision trigger at the end of it, and the camera has one as well.
So every time the camera hits one, it spawns a new object and inserts the new one instead of the one the camera can’t see anymore.

The array has 7 meshes,
The camera hits overlap trigger at array_0, destroy actor at array_0, spawn new mesh at horizon, insert new to slot 0.
Then next round, destroy array_1, spawn - insert to slot 1.

The light chase effect should still work but I don’t know why it gets broken. It should just keep on rotating between the array elements.

Good catch! thank you, I tried fixing that by connecting the incremented variable, it’s still not working together somehow

hmmm maybe after deleting the actor hit, clear the array, then get all actors of class and amend the array with that new array of actors, then get length and insert to the length +1

this way it will always add the new actor to the end of the array?

oh no wait, we want to ensure the hit actor is the 0 index, so what i would do is destroy the actor (which should be 0), then insert into the array by getting length of the array (which will be 1 less than before) and then inserting into the array of length + 1 index.

what i am unsure of is just removing the index the actor was in may just have an empty index…

let me think ill brb

does your character move forward or does the flashy boxes move towards the character?

instead of destroying and creating actors why not shift the whole set of cubes backwards an equal amount to make it look like it got deleted but just was repositioned?

I will definitely try your idea of moving the boxes as well.

I moved the destroy to happen within the mesh-BP on overlap, so I don’t have to calculate it from the outside.
When I check the development from the side, it looks like there are tons of actors being spawned, so I suspect that’s one of the problems, but idk why there are so many, cause for each one spawned there is one destroyed


UPDATE:
I switched to your moving-boxes idea and it seems a WAY better approach thanks for this! The array doesn’t break and no million actors are being spawned!!

THANK YOU :slight_smile: !!

Awesome! I am realyl glad that concept worked for you! Id love to see it in action =)