What is it?
Shadow Check Module provides a simple way to check how much of a given model is in the shadows of another model. It also allows you to specify whether you want to consider Sun or the Moon as the source of light.
How to use it?
The module exposes a simple check function.
.check(shadowCastModel, shadowCheckModel, celestialBody)
There are three main arguments. The first two arguments can either be a table of Instances or just an Instance itself. The first argument defines the model which is casting the shadows (for example a wall). The second argument defines the model that is being checked for whether it is covered in the shadows (for example a character). The last argument can either be “Sun” or “Moon” (case does not matters) and chooses which celestial body to consider (if ignored it will be evaluated as “Sun”).
The function returns two number values. The first one is the number of exposed corners and the second one is the percentage of exposed corners (though not really percentage since the value is between 0 and 1).
Is it fast enough?
Testing with the free model pine cone tree (about 65 parts) and my R15 character (about 19) parts, the function gets its work done between the 0.003 to 0.004 seconds range.
Where to get it?
Credits
@Arbeiters for creating the module.
@WingItMan for suggesting a better input/specification method for the first two arguments