DavidMcLaughlin208 / FallingSandJava

Falling Sand Simulation implemented in Java. Every pixel is simulated every frame and has its own state and intrinsic motivations.
151 stars 17 forks source link

A desperate plea for help regarding the Box2D integration #5

Open leftbones opened 1 year ago

leftbones commented 1 year ago

Hi, inspired by your video as well as Noita and other projects, I have been working on my own falling sand engine in C# for a few months. I've got Box2D full integrated, but I've run into the "holes" issue you described here, but I'm struggling with a different problem than you were.

See this video: https://streamable.com/jeyklj

The order of operations I am performing is...

  1. Place the pixels from all Box2D components into the main pixel matrix
  2. Run the pixel matrix simulation
  3. Remove all Box2D component pixels from the main pixel matrix and put them back into their respective components

Rather than just ending up with holes when the objects are rotated, it's like the holes appear and then continue to appear as it rotates further, leading to the pixels in the Box2D components just being erased entirely.

I know this repo hasn't been updated in a couple of years, I'm really just hoping you see this and are able to offer some insight, as I've been dealing with this problem for a few weeks now and I'm getting desperate!

Thanks!