Detect a row of objects (Solved)

I tried raycasting but it doesn’t output how many it hits is there another easy way to do it

1 Like

Have a row of invisible blocks fall down, if all of them hit the other blocks at the same time then you know the row is complete.

i see what you mean but this has to check a lot and that sounds laggy

It would just be one row that would come down every time something is placed down, that row would then delete itself when it falls off screen.

also, there isn’t exactly a way to send output from every block to the world block without overlaps
also you cant use colliders but u can use proximities

actually, the row of blocks falling wouldn’t work because the pieces are large sprites, not individual blocks.

1 Like

You could also shoot a projectile through the bottom row and have it count how many objects it hits. However, you would have to have each block shape made of individual square objects otherwise none of this will work anyway

1 Like

It’s Tetris so I have to detect every row not only the bottom

he means to do this for every row.

ye but it’s way too laggy and difficult to do because my project is already kinda laggy plus like I said u cant detect if each hit cause if u use mail they will overlap

different messages are a thing. But if it causes lag don’t do it

any other ideas that you may have?

idk I’m kinda busy at the moment, maybe @JR01 has an idea.

There’s several ways you could do this.
Like making long horizontal objects that detect collision or maybe count the hits with Raycasts?

If you want a better way to do this is to make a list of behavior look at each row and see if its filled.
The blocks will tell where they are in each list, like a table. Very similar to how old Tetris works.

1 Like

Also, you’re using sprites in the shape of the things you want, not individual blocks so it’s kinda hard to delete an entire row because it’s not separated.

I tried the raycast but it outputs the distance and not the amount hit

How would I make a table? i haven’t messed w/ lists

But if you have the distance and the position of the casting object you could calculate where the top of the row is in y = how high it is ?

it only outputs the closest I might not be understanding what you mean though


(20 character limit)