Barely Breathing: A Platformer Built on State-Based Physics.
by Vicente C.
Published |
43
Share
The upcoming game "Barely Breathing" uses a state-based physics system in Unity, where each environment redefines how player movement behaves. Here’s a closer look at how it works.
Barely Breathing is a puzzle platformer where you control Sheen, a goldfish trying to escape a house by moving between water. In the process you move through different scenarios that, from a technical  point of  view, require different outputs in physics.

Today I had the opportunity to get a quick talk with the devs behind this project. They shared a few tips they used on the game, part of the logic, as well as some example code with it. 

But, where does this whole idea of a fish game come from? Its developers, Jaspreet Singh and Pratyush Gupta, took inspiration from a video of a fish moving between puddles and staying in motion outside of water.

Of course, if they wanted to recreate that exact behaviour in a game, that would have required defining how movement works in different situations. 

Knowing that,  they made a controller that splits movement into states. Each state defines its own physics. The system checks the environment every frame, sets what’s the current state, and then runs the logic that corresponds:
if (inWater)
{
    if (isAtSurface) SurfaceMovement();
    else WaterMovement();
}
else
{
    if (isGrounded) GroundMovement();
    else AirMovement();
}
Each state controls gravity, velocity, rotation, and mass. By example, in water, gravity is disabled and mass is reduced. Movement is fully 3D and the velocity is set directly.
rb.useGravity = false;
rb.mass = underWaterMass;
rb.linearVelocity = (forward + right + upward) * maxSpeed;
At the surface, the fish stays in water but is constrained to a plane. The system locks the Y position and keeps horizontal movement. When the fish is landing it uses tweening instead of physics to create a short dip effect.
On the ground, gravity is enabled again. Movement is reduced, and torque is applied to make the fish roll instead of slide. A “flop” applies force and rotation every few seconds, to make the fish roll.
rb.useGravity = true;

rb.linearVelocity = new Vector3(
    move.x * groundSpeedScale,
    rb.linearVelocity.y,
    move.z * groundSpeedScale
);

rb.AddTorque(-rotAxis * torqueForce);
In the air, gravity stays active and movement carries over from the previous state. The horizontal control is reduced and mostly depends on momentum. The player’s actions still modify that movement, charging a jump adds upward force, and a twirl adds torque and a small boost.
rb.useGravity = true;

rb.linearVelocity = new Vector3(
    move.x * jumpMoveFactor,
    rb.linearVelocity.y,
    move.z * jumpMoveFactor
);
Barely Breathing is currently in development, with a planned Steam release in 2026. You can learn more about the project here:

Interested in learning more?
If you’re interested in the technical side of Unity? The Unity Dev Bundle brings together six books covering shaders, math, procedural shapes, editor tools, and character customization.

This is for developers and technical artists who want to build a stronger foundation and work with more advanced graphics and systems in their projects.
Jettelly wishes you success in your professional career! Did you find an error? No worries! Write to us at [email protected], and we'll fix it!

Subscribe to our newsletter to stay up to date with our latest offers

© 2026 Jettelly Inc. All rights reserved. Made with ❤️ in Toronto, Canada