Hi all,
I’m currently experimenting with point lights, and from what I can tell, the ideal usage for these (in a game anyway), would be to have them ‘follow a sprite’ (in a Dungeon Crawler for example).
The thing is, it’s difficult to make them truly dynamic because pointLight.pos (position) of X,Y,Z are relative to the fill-object’s dimensions NOT the screen co-ordinates, so if you have a background tiles-set for example, calculating lightPos is extremely difficult especially if you want the pointLight to follow a sprite.
I found this thread recently (it uses directional lights, but the concept is the same):
https://forums.coronalabs.com/topic/55910-applying-a-light-to-multiple-objects-with-normal-maps/
You’ll see on line 19 that the direction has been calculated based on the Developer’s light source:
somaList[i].fill.effect.dirLightDirection = { sunX, sunY, 0.5 }
But I just don’t see how this could work, as translating the ‘X/Y’ co-ordinates to anything other than percentage values is a complete no-no.
So, in a a nutshell, has anyone found a way of relating the pointLight position to co-ordinates that are EXTERNAL of the fill object’s parameters?
I’ve looked, hard, and I’m surprised at the lack of code examples with regards to composites and shaders, it’s a toughy… Any help would be greatly appreciated.
Regards
C