-1
\$\begingroup\$

preview

I’m trying to replicate the fish physics from Fish Volleyball.

If you want you can try demo of the game or watch video preview

The unique part is that the fish doesn’t jump normally — instead, when it touches a surface, its tail compresses like a spring under the fish’s weight. The fish only bounces if the player presses the jump button (e.g., Space), which should release that stored energy and push the fish away from the surface.

So the desired behavior is:

  • On collision with a surface, the tail visually compresses, storing “spring energy.”
  • The bounce does not happen automatically — it only triggers when the jump button is pressed.
  • The resulting movement should feel floaty (weak gravity, noticeable drag), but the tail bounce should be responsive and controlled.

movement example

What I tried:

  • I experimented with SpringJoint to simulate the compression and release.
  • I also attempted a custom implementation, manually applying forces when grounded.
  • Created something similar with Godot engine but was not able to push the ball with my character

With my limited Unity experience, I’m not sure which built-in components would be best for this, or if it’s something that should be handled through custom scripts

Question:

What would be a good way to implement this “chargeable tail bounce” mechanic in Unity? Should I keep working with joints, or is there a better approach (custom force logic, animation + physics mix, etc.)?

Any advice, examples, or even just pointing me toward the right Unity components would be really appreciated.

\$\endgroup\$
4
  • \$\begingroup\$ Is there a reason you have added the godot tag as well when you want a unity solution? \$\endgroup\$ Commented Aug 20 at 12:32
  • \$\begingroup\$ As I know Fish volleyball was created with godot so if you know how it can be done with godot it will be also very useful \$\endgroup\$ Commented Aug 20 at 12:39
  • 1
    \$\begingroup\$ Please choose one. If you're still curious about the other later, you can post a second question. \$\endgroup\$ Commented Aug 20 at 13:37
  • \$\begingroup\$ I removed the Godot tag, because this is clearly a question about how to achieve a certain mechanic in Unity. \$\endgroup\$ Commented Aug 22 at 6:47

1 Answer 1

0
\$\begingroup\$

I haven't built a mechanic exactly like this before, but based on the gifs, here's how I'd take my first stab at it:

  1. Give the root object of the fish a Rigidbody2D component. Any visuals / colliders will be in child objects nested under this one, so I can do things like squashing the visual shape without messing up the physics.

  2. Add two child objects with circle colliders:

    • A large one for the head of the fish

    • A small one for the tail of the fish

  3. Use physics layers or Physics2D.IgnoreCollision to toggle whether the tail collider interacts with the box collider on the floor.

  4. Write a script that controls this behaviour:

    • If the fish body is above a threshold height (high enough that falling should compress the tail spring), set a state variable to "compressing tail" and disable collision between the tail and the floor.

      This way, when we hit the floor, the tail won't collide and stop / bounce the fish prematurely - it'll fall through the floor invisibly, which we'll count as compressing the spring.

    • Each Update, this script will fire a CircleCast from the head in the direction of the tail to detect how far the tail can extend without hitting something. Then we can scale the visual of the fish's body so it looks like it's compressed by this amount.

    • We can also use the result from the CircleCast to apply a braking force / shock absorber effect to model energy being stored into the spring.

    • If we're compressing the tail and the head collider is on the ground / the CircleCast gives us a "small enough" value, we set our state value to "tail compressed" and enable the jump action. We turn off the tail collider so we're effectively just a ball now.

    • If the head collider is on the ground while in the "compressing tail" state but the tail is in the air, we landed face-down, and we set the state variable back to "tail extended" and re-enable collision between the tail collider and ground. This way we still get the oblong behaviour when flopping on the ground with the tail extended.

    • If the player presses the jump button and we're in the "tail compressed" state, apply an impulse/velocity change in the direction the tail should launch us. Once the tail collider is no longer beneath the ground, re-enable its collisions and set the state back to "tail extended"

There's probably a lot of other small things the game does to make the fishy physics feel right, like shifting the center of mass or applying forces to help the fish tend to land/"stand" tail-down, but this would get you the barebones basic behaviour of a tail that can compress and enable a jump.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.