From the course: Building a Physics-Based Platformer in GameMaker Studio Using GML

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Introduction to liquid physics in Box2D

Introduction to liquid physics in Box2D

- [Instructor] The box 2D physics engine has a special set of functions to simulate liquids using particles. You can set the particle properties like surface tension, and viscosity to simulate things like water, oils, and even gels. This Google page has some great examples and let's take a look. In the test bed section here we can see wave machines simulating water particles. Selecting the elastic particles option we can see here that several objects are created of particles that are attached to each other but not rigidly. That makes for fun things like gels. Selecting the soup option we can see that the objects of various densities inside of the liquid float to the top at different speeds. And since the particles participate in the physics simulation, they can be used to move objects around like in this sparky demonstration here. And if we set the particles up to have surface tension they can act like water like this, where objects can float on the top. You can do some really really…

Contents