Is there a javascript function where a object checks if another object (or tag) is at a certain position relative to itself, and then if so does a certain action?
For example, when a corridor segment is created, it checks if there is a segment in front (say 20m) of it. If there is, it will either turn left or right. The same applies if there is a segment to its left, it will go straight or right, etc.