a little simulation

Hello, here I am making a simulation, I try to color a sphere grid as we click on D, so here I have my first instance:

It’s all right, my Linetracebychannel is working, so I’m hoping that next I have this:

since every time my Linetrace takes (is supposed to at least) the 4 tiles around the green tile(s) but it happens tha

then if you keep going, it propagates quite linearly but it’s still not what I want, until the end or it goes all over the place xD

Here is also my Bp who manages all this : Testting > | PasteBin For Unreal Engine 4

Thank you for reading and for your help ^^

In the code, the linetrace is testing for a variable we don’t know the value of.
That’s probably the reason the checks are not where you think they should be.
A loop from 0 to 3 is 4 different values that you should have set within that array.
What are they?;base64
Ok so I went for something simpler, only on the X or Y and I succeeded thanks to this blueprint:

If i dont break, It’s not going one at a time and if i dont use the last sphere it goes 2 by 2 and (if i dont use the last sphere and i break it stop after 2 or 3 tiles) XD so for me its only work with this bp.
This bp work for X or Y or X,Y diagonal, but i’m not sure how to make it work for my basic idea :confused:

my goal.PNG

How are you placing the spheres?

are they in contact with each other?

can you expand their collision so that they can detect each other?

Oh yes in top view i can see they are all in contact :confused: and I placed them one at a time (ctrl +c, ctrl + v make it easy xD) sry :o but i can replace them with Bp and make no contact if u think its that the problem :confused:

no. What I’m getting at is that you can color them By contact.

First, I would sugfest placing them with a HISM component. Just so they are all instanced properly and part of an object you can always move.

To do that you make a single Actor BP, add the hierarical instance component and script a way to add components to it.

You can place the items however you want in the script. Rows by columns will be easier then going sideways like the numbers you showed.

Then, once that’s done, you modify the sphere object and expand its collision by a little so that you can detect overlaps.
You set the items to detect collisions (physics disabled) and detect overlaps only with themselves.

With that done you can click on any instance and get whatever other instance it comes into contact with by Overlap Event.

That should get you able to color the spheres one by one in whatever order you want by just comparing the location of the spheres you overlap with.
it also provides a reference you can use to shift to the next sphere or object.

Ok xD I may have forgotten to mention that I was a beginner . But for the moment I’ve passed the part on HISM and clearly I’ve discovered that it’s extremely practical. So here I have my block of static mesh thanks to this BP: I hope its the right way to do it .

But here I try to change the material, for example the 10th mesh, but it doesnt work. I know I made a huge mistake but I don’t know where . My apologies for this blueprint horror.

Rly thx for helping me <3

So, you need an Index to refer to.
your hit results from before will return an index value if they hit a component of an HISM. Its one of the pins out of the hit.

You could combine what you had before to this.

Using the ID you can isolate the element to work on.
Then you just change the scalar or color value in BP like you probably did before.

Collisions are a bit hard to understand at first, but if you keep trying things you’ll get it. Its a different approach to go about, but it could be better in terms of performance and practicality.