Devlog: Platform Movement and Character Interaction Improvements
Current Stage of Development: In this stage of development, I've been focused on refining the platform movement system and ensuring smooth interaction between moving platforms and the player's character. Initially, I was experiencing two primary issues: jittering when the character stood on moving platforms, and platforms slipping out from under the character during movement. These issues needed addressing to improve both player experience and the overall polish of the game’s mechanics.
Challenges Faced:
1. Jittering on Moving Platforms:
One of the early problems I faced was jittering when the character stood on a moving platform. The platform’s movement wasn’t smoothly synchronized with the player’s position, causing noticeable jitter, which broke immersion and affected the player experience.
- Cause: The platform and character were moving out of sync due to direct manipulation of the platform’s
transform
, which conflicted with the physics-based movement of the character'sRigidbody
. - Solution: The jitter was resolved by switching the platform’s movement to a
Rigidbody
-based system. UsingRigidbody.MovePosition
instead oftransform.Translate
ensured that the platform moved smoothly within the physics engine, which worked seamlessly with the character's physics-based movement.
2. Platform Slipping Out from Under the Character:
Once I resolved the jitter, I encountered another issue: the platform would often slide out from under the character. This was problematic, especially during fast movements or when multiple platforms were involved.
- Cause: The character and the platform were treated as separate entities by the physics engine, which caused them to move independently. As a result, the platform would move away from the character unless the character was tightly bound to it.
- Solution: I implemented a system where the platform's movement delta (the change in position between frames) was sent to the character controller, which could use the information as an adjunct to player input and keep things more modular. This kept the character’s position synchronized with the platform’s movement, eliminating the sliding issue and keeps player movement contained to itself. Here’s a brief breakdown of the approach:
- Platform Script: The platform calculates its movement delta (difference in position between frames) and passes that delta to the character when they are in contact with the platform.
- Character Script: When standing on a platform, the character’s
Rigidbody
is moved by the platform’s delta, ensuring the character moves in sync with the platform. This allowed for smooth movement without the need for complex parenting or transform manipulations.
3. Tweaking Friction (Optional Solution):
As an optional step, I experimented with physics materials to increase the friction between the character and the platform. While increasing the friction did help "stick" the character to slower-moving platforms, it wasn't sufficient for faster-moving ones. Therefore, I opted to stick with the movement delta approach, as it gave the most consistent results. Additionally, it created this effect that felt almost like the player was trudging through mud, and that did not feel good to play. Although, this would be good to keep in mind for other puzzles, as it definitely made platforming more challenging, but in this situation, I had already designed the course to be difficult enough that I did not need to throw in any more challenges for the player.
Key Takeaways:
- Rigidbody Movement: When working with multiple moving parts, it is crucial to align components and methods used to move each. Doing so will avoid conflicts with Unity’s physics system and ensure that physics-driven objects interact smoothly and predictably.
- Delta Synchronization: By calculating and applying the platform’s movement delta to the character’s
Rigidbody
and allowing the character to deal with applying the delta, I was able to achieve seamless, jitter-free platforming mechanics. - Friction Adjustments: Although friction changes were helpful for slower platforms, they weren’t a complete solution for all scenarios, particularly with faster-moving platforms.
Next Steps:
Moving forward, my focus will be on refining the overall gameplay experience with moving platforms. Specifically, I’ll be looking into:
- Rotating Platforms: Implementing platforms that rotate as well as move and ensuring the character interacts smoothly with both movement and rotation.
- Multiple Platforms: I also implemented something to prevent intersecting platforms from pulling the character away from it's current platform, but I think it requires more testing under different circumstances. Thus far, I have already witnessed an issue where the platform might not recognize that the player is intending to switch platforms, and will drag the player the wrong way, or apply a movement delta in a surprising way.
- Visual and Feedback Enhancements: Now that the core mechanics are working well, I’ll work on adding more visual and audio feedback to platform interactions to make the movement feel more responsive, polished and satisfying.
Closing Thoughts:
This stage of development has been all about refining the character’s interaction with moving platforms. I’m pleased with the progress so far, and the solutions implemented have drastically improved the feel of the platforming mechanics. There’s still more to be done, but this feels like a significant step forward in creating smooth, engaging movement for the player.
Stay tuned for more updates as my development journey evolves!
Get In Heaven's Shadow
In Heaven's Shadow
Gameplay demo for a 3D action adventure platformer that explores a celestial realm inspired by Asian folklore.
Leave a comment
Log in with itch.io to leave a comment.