Read notes and credits if your looking to make your own version of this. This project is showing off a method of obtaining the surface normals from a sprite costume. The function (scratch block) used it called "Normal | Scan" and it take in 4 inputs and returns the direction that is tangent to the edge of a costume/sprite. Move the mouse to the grey blob such that the blue circle overlaps the blob. You will see that the arrow points away from the edge of the blob. The scan block inputs are: - X - Y - Resolution - Radius The x and y inputs tells the function where to start. The resolution tells the function how far to rotate in degrees. And the radius tells the function how large of an area should the function check in. The smaller the radius is, the more accurate the calculation is. But the distance needed to be from the blob gets smaller. The output of this function is the called "Normal | Scan | Normal Direction". However, the function does output 4 other values which are the 2 points it finds and uses to calculate the normal.
This is a demonstration rather than something designed for you to copy and paste into your projects. The majority of code in this project is just part of my Tool Box of things I have in every project I make. So you can cut a lot out! The "Normal | Scan" function is the only function you need to look at to learn how this thing works. All the other functions used in that function are self explanatory. Except maybe the ATAN2 function. That just takes in to points and returns the direction/angle they are from each other.