The objects like walls and things in between your light and the camera have to be entityPicked
entityPick level,2 ; polygon picking enabled for this mesh
Note: this might slow down your game depending on how complex your level geom is and how often you call EntityVisible. In fact, it's quite a bottleneck command, and you should try and use it as little as possible.
You might have twenty lights in your level, with which you're calling EntityVisible(camera,lightsource) every loop. That's quite a slowdown.
You might think about making a check for distance before checking whether it's visible.
entityPick level,2 ; polygon picking enabled for this mesh
Note: this might slow down your game depending on how complex your level geom is and how often you call EntityVisible. In fact, it's quite a bottleneck command, and you should try and use it as little as possible.
You might have twenty lights in your level, with which you're calling EntityVisible(camera,lightsource) every loop. That's quite a slowdown.
You might think about making a check for distance before checking whether it's visible.