defold / sample-lights-and-shadows

Example of how to achieve pixel perfect shadows in a 2D view
MIT License
31 stars 5 forks source link

Why is arc_angle limited to 180°? #4

Closed haath closed 2 years ago

haath commented 2 years ago

The README says:

Arc angle of the lightsource. Can be used to generate a cone of light up to an arc angle of 180 degrees. Anything above 180 degrees will result in a full circle.

However simply removing this branch from the update_angle() function in lightsource.script#33, and setting an arc_angle larger than 180° works fine for me:

if arc_angle > 180 then
    x = 0
    y = 180
    z = 0
    w = -180
else

image

So why is this limitation of 180° in place?

Let me know if you think it can be removed and I'll make a PR :)

britzl commented 2 years ago

I've included this in an update of the master branch. Thanks.