I thought I was storing the asteroid UID within the miner object. But that is not the case? So would be better to store that value in the asteroid object?
You are storing the asteroid UID in the Miner. But there is only one miner, and you want to pick the correct asteroid later. That's what is happening. You are picking the Asteroid, by UID, that is stored in Miner.
Ok so when I have more than 1 miner, I’m going to have issues right?
Develop games in your browser. Powerful, performant & highly capable.
Yes and no. The trick will be picking which Miner is current, to associate it with an Asteroid, but as far as the the distance check, you would just start with a For each Miner and then do the same thing.