at some point it has to intersect our screen in other words it has to go to the bounds and at that point we know we want to have some kind of collision but the problem is we now need to know what direction it's going to end up going in if we go a bit closer you can actually figure out what that vector is pretty simply because we know what the incoming vector is we know what the normal of the screen is in some sense and all we want to do is reflect it based off that normal that should be the outgoing vector mathematically that's going to end up looking like you know taking a dot product to find the angle of this and then you double it to kind of swivel it by two so it's going out the other direction and now you have your outgoing vector so boom uh we we have a collision but of course you know same problem right it's gonna go out of bounds so the way that i generated this with the geometry nodes is i kind of redid this calculation over and over and over again i think i did five or six collisions because when you look at the node network this thing gets monstrous but if at some point we get a loop node then i'll be able to you know generalize it however many collisions but whatever we have five or six collisions for our simulation and of course let's not forget what we're interested in is knowing when this thing hits a corner so we need to have some kind of condition for that so let's say that it goes fairly near a corner because it can't go exactly in there right there's always going to be a bit of bouncing uh within some threshold i'll say if it kind of goes inside the zone uh we'll color our particle a different color and we'll say boom this has hit the corner at some point so what we have so far is a very simple simulation you know you have a particle a direction it bounces and if it hits a corner any four of them um it turns green which means let's now just generalize this thing let's spawn in a bunch of points and run the simulation and uh you know now we can see you know which ones turn green and we can launch this at uh randomly distributed points uh sparse points dense points it doesn't really matter but uh the key takeaway is you know we know which particles are eventually going to hit the corner so let's take that information and actually color our particles to begin with so we know which ones are going to hit before we even launch the simulation well what you're going to notice is that they kind of follow this geometric pattern no matter what direction we pick they they kind of come in these bands of lines um and if you think about it that makes sense because if a particle is going to collide right with the corner the one right before it that's going in the same direction that's trailing it of course is also gonna hit it so of course you get these geometric lines and that's gonna change depending on the direction even more interestingly again if we're running a simulation with only five or six collisions which is a big preface for this right i'm only doing five or six collisions right this might be different if it's infinite you're gonna notice that the denser our
NO_SEGMENT_TOKEN