I am about to create a Jump'n'run game using Box2D for the physics. I am asked to add a Dropshadow to the main Character, but as I noticed this could become quite complicated. Basically the Light should be parallel with an angle of 90°, so from top to bottom. Please see the image below.
I would like to Ray Cast the upper left and upper right edge of the characters AABB downwards to the ground and find the lines marked in Red.
Right now I have good Idea, I just thought to use a whole bunch of Rays, but this might become a performance bottleneck and is not that precise anyway.
How could I solve the »Shadow-Problem« properly?
Thanks in ahead!
As asked in the comment, here some additional notes.
The angular line at the bottom is meant to be the ground and the rectangle just below the character represents a platform. These are the shapes which should receive the shadow. The light should go from top to bottom, like raindrops falling down if no wind is present. So the extends of the AABB in x-direction represent the left and right region which should create the shadow, or, in other words, the width of the shadow.