How to find the lowest Y pos among objects

Hey y’all. I’m hittin a bit of a wall right now and Google hasn’t given me any answers.

Any idea how to find which instance of a group of objects has the lowest or highest y value?

Let’s say i have 10-20 objects going down the screen like a list. If i want to know, of those objects, which one is at the top and which one is at the bottom based on its coordiantes, what would i do?

Using an ID for each object doesnt work in my case because there is no certain number of objects. So while i can easily ID the top one, i wont know what the ID of the bottom one is since it can vary.

I’m at a bit of a loss here and I appreciate any help i can get!

My initial idea is using an ID. Use a “for each object” to assign an ID while also comparing them. Use variables to track the ID of the lowest/highest and others for the current highest and lowest for comparison.

Edit: if this is an organized list then maybe you can use ray cast from the top/bottom to pick the first object or pick nearest object from a point above or below the list.

1 Like

Deffinately gonna try the raycast idea. Thank you so much!

1 Like