Making Dark Roll 2's Pillow Feel Soft in Unity.
by Vicente C.
Published |
2
Share
Paweł Zając explains how he made Dark Roll 2's pillow deform on contact and reused the effect for sludge that slows the player down.
Developer Paweł Zając needed a soft landing spot on one of the maps in Dark Roll 2, his Unity platformer. 

He modeled and textured a pillow, then disabled bouncing and fall damage when landing on it. The landing worked, but the pillow still did not look soft under the player.
Paweł was not confident with shaders, so he started experimenting with a C# mesh deformation script.

The script uses the player's SphereCollider to determine which vertices to move. It pushes them inward to make a dent, with less deformation farther from the contact point. Around the dent, nearby vertices move outward to create a small bulge, making the pillow look compressed.

The script also stores each vertex's original position. When the player moves away, the mesh gradually returns to its shape. Initially, the vertices moved at a constant speed, which looked stiff. Paweł later added lerping and smoothing so both compression and recovery looked more natural.

The pillow has around 1,000 vertices and 2,000 triangles. Paweł says a denser mesh would improve the effect, and some vertices still jump slightly, but he is happy with it for a small detail in the game.
The response to the pillow made Paweł want to try the deformation elsewhere. He has since reused the script for sludge, adding a separate script to control how it affects the player's movement.

While rolling over the sludge, the player sinks slowly. Staying still makes them sink faster, and the deeper they sink, the slower they move. The mesh deformation shows the surface giving way, while the additional script handles the sinking and slowdown.
See 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.
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