Page 1 of 1

Checking for objects right next to another object

PostPosted: Fri Nov 05, 2021 12:18 am
by BoxxedBread
Been trying for a while now to figure out a way to find objects right next to another object. My current method right now is to create a box next to the object I'm testing with and listen for a collision, but this is inefficient due to how often I need to check, and unreliable because of the high movement speed it has. Is there another, more reliable way to do this?

Below is a visual representation of what happens when I check for objects using my method
Image

Re: Checking for objects right next to another object

PostPosted: Sat Nov 06, 2021 9:49 pm
by UnityDogGaming04
There's some code out there that indexes every single object in the scene, and adds the ones that fit a certain condition, at least if I recall correctly. I've never used it and I don't even know what it looks like for sure, but look through the forums for anything along the lines of (something here that means every object) {condition that each object must meet, like math.vec.dist(pos, e.pos) < 1}