ANDREW SIPES
GAME DEVELOPER

WaxHeart is a puzzle platformer where you play as Waxboy with a lantern for a heart. You'll journey through a dark in search of your lost memories encountering many monsters, mysteries and challenging puzzles.

Teaser Trailer
Platform: PC
Playtime: TBD
Engine: Unity
Role: Software Engineer (Unity)
Time On Project: Nov 2024 - Current
Team Size: 20-30
Website: waxheart.info
Steam (Free Demo!): Steam
MY ROLE
-
Contributed to code base by taking Trello cards on new Features, and Bugs
-
Participate in play tests and provide feedback to help improve gameplay and identify bugs
-
Participated in Git Workflows, and Code Reviews to ensure clean code was added to the game
-
Work with design team to bring new features and improvements into the game.
-
Attended Engineering Department meetings to discuss current progress, Sprint Planning, and discuss improvements / changes to the development team process
In the final level in WaxHeart, the level design team is planning some puzzles requiring moving platforms. Prior to this design change, boxes would move on the platform but they were not interactable with the player.
Objects the player can interact with all derive from a Base Interactable Object, allowing the logic to be similar between them except for special cases. With Boxes, we have the player attach to the box, and the box moves with the player's input. The interaction system does not take into account the platform velocity, and in it's current state would separate the player capsule from the box triggering our break distance (maximum distance allowed between the player and the box), forcing the player to revert to their normal non-interacting state.

Based on this behavior, I was able to infer the following:
-
The player was not moving with the box as the platform moved
-
The Box was not attaching to the player
-
The platform was moving too quickly for the interaction to occur.
To get a better understanding of how the system was working, I started to track velocity of the player at various points of the interaction process:
-
Any time velocity changed
-
When the box was "moving" with the player
I started noticing several points where I could see the velocity being set to zero, which indicated that either the velocity of the platform was not being applied to the player or it was being set to Zero explicitly.
Using Unity's Stacktrace from the Debug logs entries, I was able to locate where velocity was being applied to Zero.


My investigation led me to the CharacterMovement Script, where we update the the player's velocity using the UpdateMovingPlatform Method, here we're calculating from the RigidBody, assuming the player is on a Rigidbody based platform. Since the Platform system we're using is Rigidbody, I was able confirm in the code (and visually), that this code was applying velocity to the player.
This led me to think - "What if the player's velocity is being set to 0 during the time of interaction?"
I started to follow the interaction logic and found that the Player Interaction Logic is doing the following:
-
Using interaction states based on the time in the interaction process (Enter / Interacting / Exit)
-
These states control animation and the location of the player during the interaction process
-
-
When Debugging I found the referenced velocity variable was being set to Zero during the first Entering state, this revealed why the player capsule was not following the interaction object
In order to resolve this, I made a few changes:
-
I updated the velocity calculation to use the currentInteractionObject's velocity.
-
Since the Base object does not have a velocity, and we do not always expect there to be a velocity I created a method called GetInteractionObjectVelocity
-
This Method will return Vector3.Zero for objects with no rigidbody (on the base class) which could be overridden in the child classes to the return the rigidbody Velocity, if desired.
-

After this was resolved, I found another issue when the player would attach the box, they would appear out of place/ position, and their arms would warp
This was due to how the position of the player was being calculated when entering Interaction, before we would lerp to the target position which was set determined before the Interaction started (on the object).
With moving platforms, this location has to be updated on every update call to ensure lerp moves the player into the required position, a small change to consistently updating this value during each update call to the current interaction's objects transform resolved this.

BEFORE: AFTER: