I Am working on a 2D game in XNA that needs some physics. I have found that physics engines such as Farseer will not cut it due to some of the ways they work. (thats a long story involving rewriting the code 3 times to finally figure out that I needed to write the physics myself.) So according to the reference material I'm using, the only data that I need now is a normal for the surface of collision.
This is using per-pixel collision detection using sprites. I currently have an array of all the overlapping pixels and their locations. I would like to use that data to some how average the locations of the overlapping pixels to figure out the normal for that surface. this should then allow me to have collisions with objects of irregular shape but still retain realistic physics interaction.
If anyone has a suggestion on how I could use this pixel info to figure out the surface normal or something close enough, that would be great.
Thanks.