1. Lost Twins 2
  2. News

Lost Twins 2 News

Devlog # 51 - Character physics in water Part 2

Hi again!
In our last devlog, we tackled the intricacies of character physics in water, exploring how buoyancy and fluid dynamics affect movement. This time, we’re taking it a step further by diving into the interactions between characters and in-game objects submerged in water. From floating boxes to sinking boulders, we’ll walk you through the mechanics behind how these objects behave when they enter the water, and how we’ve enhanced their physics to create a more immersive and dynamic experience. Let’s jump in!

These objects already have rigidbodies, colliders, and ground physics implemented, so adding buoyancy to them was the logical next step. Just like the characters, we added buoyancy forces to make these objects behave more naturally when submerged. The boulder, being denser, sinks slowly compared to how it behaves in air, while the box rises to the surface at a steady pace.

[previewyoutube][/previewyoutube]

Floating Box Physics

The floating box required a few extra tweaks to make it feel more natural. To achieve a gentle wobble when the box floats at the water’s surface, we added a slight variation to the buoyancy force. Initially, the box rises and falls more noticeably when it first reaches the surface, as the buoyancy force gradually decreases and stabilizes. As the forces of gravity and buoyancy find a balance, the box settles, but we continuously introduce slight fluctuations in the FixedUpdate() to maintain a subtle wobble effect.

Additionally, we had to account for when a character lands on top of the box. Since all our physics are custom, we applied a small downward impulse when the character jumps onto the box. This decreases the buoyancy just enough to submerge the box slightly more than when the character is not on it. To add a bit of realism, we also introduced a small torque force. The torque is based on the character’s X position relative to the box’s center, causing the box to rotate toward the character’s landing position. If the character lands too far to the side, the box rotates by up to 90 degrees, eventually submerging the player if they fall off.

To ensure the box remains upright in the water, we applied a lerp function to rotate the box back to the nearest 90-degree angle relative to the water’s surface.

[previewyoutube][/previewyoutube]

Pushing Boxes Underwater

When the character pushes a box underwater, we use the OnCollisionEnter() function to detect when the player collides with the box. If the player presses any directional key, force is applied to the box in that direction. Additionally, it switches the character’s animation from normal swimming to a “pushing box” animation to reflect this action.

Unstucking Boxes and Boulders

Sometimes, the box or boulder can get stuck in corners between a wall and a roof. When this happens, we added an extra layer of logic: when the character presses the up key while stuck in a corner, an additional force is applied in the opposite direction of the wall to free the object. This ensures the box or boulder can escape these tight spots and continue interacting with the character.

[previewyoutube][/previewyoutube]

In the next part of this water series, we’ll be covering how we implemented some of the special water-based effects for both characters and interactable objects. Stay tuned for more!

Best regards,
Playdew Team

https://store.steampowered.com/app/1752540/Lost_Twins_II/

Devlog # 50 - Character physics in water Part 1

Hi guys!
Water is finally here! Adding it to our game wasn’t just about making it look cool—it completely transformed how the world and the player interact. From realistic buoyancy to swimming mechanics, creating water physics has been both a technical challenge and a rewarding experience. In this devlog, we’ll take you behind the scenes to show how we implemented character physics in water, tackled unexpected hurdles, and made swimming feel natural and fun. Let’s dive in!

Custom Physics for the Player:
In our game, we’ve built custom physics for all player interactions. While the character uses Unity’s Rigidbody and CapsuleCollider, there’s no gravity by default. Movement is handled manually in the Update() function using boxcasts to determine accurate X and Y positions. With water, we had to extend this custom approach.

Detecting Water Interaction:
To switch between normal platforming and water physics, we added four child transforms to each water area to define its bounds. These allow us to detect when the player enters or exits water. Once in water, the physics shift. A buoyancy force is introduced alongside gravity. For example:

If the player enters from above, they sink initially until buoyancy kicks in, eventually bringing them back up to the surface.

For special water areas (like those suspended in air by magical force fields), the player can enter from any direction, but the buoyancy-gravity interaction still ensures a natural flow.

Swimming Mechanics:
When the player provides input (using arrow keys), the dynamics change: Buoyancy and gravity are temporarily disabled, and the player accelerates in the direction of input. Velocity is clamped to avoid unnatural speeds, creating a deliberate swimming motion.
Additionally, the character’s head rotates to align with the direction of movement, enhancing immersion and giving the swimming motion a natural feel.

[previewyoutube][/previewyoutube]

Handling Physics in FixedUpdate:
Unlike ground movement, which is processed in Update(), water movement is handled in FixedUpdate() for better collision accuracy. Unity’s physics engine takes over here, ensuring the player is stopped by obstacles like walls or floating debris.

However, this introduced an unexpected issue: the camera became jerky since it was still updating in Update(). To fix this, the CameraController now dynamically switches to FixedUpdate() when the player enters water, providing smooth tracking.

[previewyoutube][/previewyoutube]

What’s Next?
This was just the foundation for water physics. In the next devlog, we’ll explore:

Interactions with objects in water, like floating boxes and sinking boulders.
The FX that make water feel alive, from ripples to splashes when the player interacts with it.
Thanks for reading, and as always, feel free to share your thoughts and feedback. Stay tuned for more! 😊

Best regards,
Playdew Team

https://store.steampowered.com/app/1752540/Lost_Twins_II/

Devlog # 49 - Creating Connection Overlays for Puzzle Guidance

Hey everyone! We’re back with another devlog update.. In our puzzle game, each level features three distinct blocks, each with its own unique environment, obstacles, and pathways. Each block has doorways on both the left and right sides that are meant to connect to doorways on other blocks. During playtesting, we noticed that players were having trouble figuring out which doorways connect between blocks in our puzzle game, leading to some head-scratching moments. So, we set out to create a simple, effective way to help players navigate these connections without feeling lost. Here’s how we tackled it!

Step 1: Designing the Overlay in Photoshop

The first step was creating a visual map for each block. Using Photoshop, we traced the layout of each block, focusing on key elements:

Floors, Obstacles, and Platforms: These were outlined to show where characters can move and where they cannot, helping players visualize possible paths.
Doorway Connections: a color-coded system to indicate potential connections
Red: Doorways that cannot connect to the current block.
Green: Doorways that can connect to the side doorways of the block in focus.
Blue: Doorways that can connect to the bottom doorways of the block in focus.

This tracing process created a simplified, visual guide for each block, making it easier for players to understand the connection possibilities at a glance.

WITHOUT OVERLAYS



WITH OVERLAYS





Step 2: Enhancing the Overlay in Unity

After completing the tracings,we imported the Photoshop files into Unity and worked on integrating them into the game. To make the overlays more effective, we developed a custom shader that adds a subtle glow effect. This glow highlights the overlays without being too intrusive, making them stand out even when players zoom out to view the entire level. The shader’s effect directs players’ attention to key areas without overwhelming the visual experience, providing a clean, intuitive map.

Outcome:
The introduction of the Connection Overlay system has significantly improved the player experience. The overlays offer clear visual guidance on how blocks can connect, reducing confusion and helping players solve puzzles faster. This feature has now become a core component of our game’s user experience, offering an engaging way to assist players without breaking immersion.

By simplifying the connection process, we’ve been able to enhance the overall gameplay flow, making the puzzle-solving experience more enjoyable and less frustrating. We look forward to sharing more updates as we continue refining the game!

Best regards,
Playdew team

https://store.steampowered.com/app/1752540/Lost_Twins_II/

Devlog # 48 - Water cutscene

Hi guys! This week, we focused on enhancing the water flow mechanics with a dynamic cutscene that highlights the water filling and emptying containers. To achieve a more engaging visual experience, we needed a smooth camera system that follows the movement of the water seamlessly, giving players a clear and immersive view of the process. Here’s a deep dive into how we tackled this challenge.

To showcase the water flow mechanics effectively, we needed smooth camera movement that follows the water filling and emptying process. This way, players can fully observe the changes as they happen in real time. We added a top boundary to the water prefab, which tracks the water’s height dynamically as it moves. This boundary’s position is stored in a `targetPositionEndOffset` variable.

The top bound stops moving when it aligns with the water surface. However, when the water fills another container below, the camera needs to follow the action seamlessly. To make this happen, we introduced an additional Y-axis offset, allowing the camera’s target position to update frame by frame. The duration of this movement is calculated based on the Y-axis distance of the water from top to bottom.

[previewyoutube][/previewyoutube]

To enhance the visual experience, we applied Robert Penner’s Quart-Ease-In-Out easing function. This easing starts slowly, accelerates in the middle, and decelerates at the end, creating a natural and fluid camera movement.

As a result, the camera smoothly tracks the water’s flow, providing players with a seamless viewing experience.

Check out the code snippet implementing this logic below:

private IEnumerator MoveTopPointCoroutine()
{
float timeElapsed = 0f;
float adjustedT = 0f;
timeToFillWater = 0f;
targetPositionEndOffset = Vector3.zero;
timeToFillWater = CalculateTimeToFillWater();

float topEndOffset = CalculateDistance() - 20f;
float topEndPositionCurrentOffset = 0f;

while (timeElapsed < timeToFillWater)
{
adjustedT = Easing.Ease(easingEquation, timeElapsed / timeToFillWater, 0.0f, 1.0f, 1.0f);
topEndPositionCurrentOffset = Mathf.Lerp(0, topEndOffset, adjustedT);
targetPositionEndOffset.y = topEndPositionCurrentOffset;
timeElapsed += MyTime.deltaTime * 0.5f;
yield return new WaitForEndOfFrame();
}
targetPositionEndOffset.y = topEndOffset;
}


This new camera system not only adds polish to the cutscene but also helps players appreciate the fluid dynamics at play, making the entire experience more satisfying. We’re excited to see how this feature elevates the gameplay, and we can’t wait to hear your feedback. Stay tuned for more updates as we continue to refine the mechanics and visuals of our game!

Best regards,
Playdew Team

https://store.steampowered.com/app/1752540/Lost_Twins_II/

Devlog # 47 - Modular library asset

In our latest development update, we’re diving into the process behind our level-building approach and the tools we’ve crafted to streamline it. From a library of modular assets to precise layout techniques, our goal is to ensure each environment is visually cohesive and optimized for performance.

We’ve developed a modular asset library specifically for streamlined level building, with unique sets of assets tailored to each zone. Leveraging this asset library,we construct each area on a 1x1m grid—marked by green boxes—to maintain consistency and precise alignment. Using a kitbashing approach, we combined different assets to craft the desired layout, refining architectural details along the way. Once the layout is set,we added foundational lighting. We’re using baked lighting for optimal quality, with each block assigned a dedicated 1k lightmap to preserve detail and ensure high visual fidelity.


[previewyoutube][/previewyoutube]



Thanks for tuning into this devlog! Our level-building journey is all about refining each space to create an immersive and visually stunning experience. Stay connected for more updates as we continue crafting each unique zone. Feel free to share your thoughts and questions—we’d love to hear from you!

Best regards,
Playdew Team

https://store.steampowered.com/app/1752540/Lost_Twins_II/