Here's an example of changing the time of day of the sky based on an object's vertical position in the space:
function MeshEntity:onMove() self:getSpace().horizon.space.timeOfDay = self:getWorldPosition().y * 4 end
In the above example, we assume we are in a space whose horizon space is a SkySpace (which is the case in the default File/New space created). In the example, we set the time of day, which expects a range of [0,24], to our Y (or vertical) position multiplied by 4 which means 6 vertical units = one entire day.
Comments
0 comments
Please sign in to leave a comment.