I have some simple pick code I will try to dig out tomorrow.
Scenario, I had a friendly tank driving about that when it got it in line of sight, an enemy tank would turn and fire to cause damage. The friendly tank could go behind a wall so it could not be seen and the enemy tank would stop firing. Then when the friendly tank came into view again at the other end of the wall, the enemy tank would turn and fire again.
Sometimes its a case of starting a fresh project just with your problem and starting the code from scratch. I did this because the enemy tank kept firing through the wall. Sorted it though. Also take a break for a bit, watch a film sleep on it.