Without getting bogged down by the specific mechanics of my game, I have 2 physics objects colliding with each other, a Dynamic one and a Static one. When they collide, I would like to paint part of the Static one with a Red Circular Gradient where they collided, probably using a Shader. Simple.
What I've done so far:
- I've set the world callbacks to get the collision information
- I've sent this collision information to the corresponding object in my game that is in charge of drawing the Static object
I don't know how to send all the information to the shader so it knows where to draw the Gradient if the information is several collision coordinates. AFAIK and searched, you can't pass lua tables to GLSL Shaders through Shader:send().
I thought about drawing a canvas that draws where the collisions happen and then sending that, but I don't know if this is the right approach and I should keep exploring this angle (if it is, I would a small example if possible). I'm very new to shaders (Just the other week I managed to get some text to change color whenever a rectangle was drawn over it and I was ecstatic about it) so any help is welcome. Maybe I shouldn't even be using a shader for all I know!