Started translating light casting logic