Well you had a good point about the doughnut, and made me hungry thinking about them!
lol
Thought I'd better check my air code, indeed it works
Function GetObjectIDAtLocation(x, y, z, Distance)
hit_id = 0
// check x
hit_id = ObjectRayCast(0, x-Distance, y, z, x, y, z)
if hit_id<>0 then ExitFunction hit_id
hit_id = ObjectRayCast(0, x+Distance, y, z, x, y, z)
if hit_id<>0 then ExitFunction hit_id
// check y
hit_id = ObjectRayCast(0, x, y-Distance, z, x, y, z)
if hit_id<>0 then ExitFunction hit_id
hit_id = ObjectRayCast(0, x, y+Distance, z, x, y, z)
if hit_id<>0 then ExitFunction hit_id
// check z
hit_id = ObjectRayCast(0, x, y, z-Distance, x, y, z)
if hit_id<>0 then ExitFunction hit_id
hit_id = ObjectRayCast(0, x, y, z+Distance, x, y, z)
if hit_id<>0 then ExitFunction hit_id
EndFunction 0
CreateObjectBox(999, 10, 10, 10)
SetObjectPosition(999, 124, 457, 865)
do
print(GetObjectIDAtLocation(124, 457, 865, 100))
Sync()
loop