NOC W4 – Bubbles (An Imaginary Environment)

p5.js Web Editor | NOC W4-An Imaginary Environment (p5js.org)

In this assignment, I created an environment full of bubbles, and all bubbles are attracted to each other based on their gravitational attractiveness. Simultaneously, upon collision, there’s a 50% of chance that the bubbles will “emerge into 1” and form into a bigger bubble, or bump into each other and bounce off. The bubbles are restricted by air resistance which is created based on their sizes and gravity.

During the creation process, I utilized checkCollosionWith(others) and applyGravitationalAttractionBetween(others) functions learned in class to create the feeling of attracting and bumping each other upon collision. Simultaneously, to add to the air resistance, I utilized the same method used in the last assignment, which is the F=(1/2)CρSV^2 formula.

I faced some difficulties while trying to make the disappearance of the bubbles upon collision happen. Initially, I popped out the “other” object and leave the “this” object, which creates some glitches and the change of radius doesn’t apply to the bubble. Then I tried to splice out the “this” object and made the effect happen. However, I actually don’t fully understand why this works and the other doesn’t, which need further exploration.

Leave a Reply

Your email address will not be published. Required fields are marked *