Lunar Lark Games Logo - Text

Creating a Forklift in Unity

A quick overview of how I built the car controller for the forklift in my upcoming game, ‘Forkin’ Around’.

Lunar Lark Quest Log for indie game Forkin Around
Lunar Lark Quest Log L u n a r L a r k Q u e s t L o g
Composed by:

Jordan Harriger

Indie Game Developer

In the last Quest Log, I discussed my game dev journey up to this point. Near the end of that log, I had just discovered the main hook for my game – a physics-driven forklift. I settled on this idea after prototyping a quick version of the forklift, which had me laughing and genuinely having fun. This was probably the first time I started a game this way, and honestly, I really liked it.

A Physics-Driven Forklift?

Yeah, I’m not sure if I’m even using the right terminology here, so to clarify, I wanted the forklift to be driven by and react to the physics system in Unity. This is a common approach used when creating a car controller, as it produces a result that feels more realistic. I say all of this as someone who is still learning, so if you’re interested in making your own car controller in Unity, I really suggest checking out some of the assets on the Unity Asset Store to see what makes them tick. They often are building on top of existing Unity components like the wheel collider and wheel collider suspension and give you access to properties like max speed, vehicle mass, and motor force. This is actually exactly what I did to get a bit of a head start on the car forklift controller. This gave me a jumping-off point, but even the most robust assets likely don’t account for the unique behavior of a forklift. I’d have to make some additions and improvements, so I got to work.

The To Do List

Dynamic Center of Gravity

A key mechanic in my game involves the forklift reacting to the cargo on the forks, and the center of gravity changing as this happens. The intended feeling I want the player to experience is instability, somewhat akin to balancing something precariously. This feeling gets amplified when they have heavy cargo, and the forks are raised high. To achieve this result, I created a custom ForkliftController class to handle all the logic for my car controller customizations, aiming to keep the two systems decoupled. Using some mathematical calculations, I take into account the current load mass (more on that soon), the forklift mass, the height of the forks, and a few other values to calculate a new center of gravity. To visualize this in the editor, I used the OnDrawGizmos method to display a red sphere, which helps me see this newly calculated center. Lastly, for gameplay-related reasons, I wanted the ability to artificially stabilize or destabilize the forklift, so I also incorporated a stability factor value that I can adjust.

Custom Center of Gravity Gizmo

Dynamic Cargo System

Next, I needed to inform the forklift controller about the weight on the forks. In the video above, I am actually simulating a load of 8000kg to showcase the gizmo, which is why it moves so dramatically. Of course, in my game, I want this weight to be calculated dynamically so that I can easily add new cargo types and change their respective weight/mass. Since each piece of cargo will have a Rigidbody Component, which itself has a mass value, I decided it was best to utilize that existing property and simply sum up all the cargo on the forks to calculate the new mass, and consequently, the new center of gravity.

ForkliftPlatform collider

This process is facilitated by a collider on the forks, which contains a script called ForkliftPlatform. This script checks for colliders with a Cargo script, then iterates through that collection, sending the total load to the ForkliftController, which is a singleton. This makes it incredibly easy to accomplish. Now, the forklift can pick up and drop cargo, accurately adjusting the total mass of the forklift, all without the need for writing any additional code.

Each pallet weight 55kg – Notice how the forklift’s suspension is compressed as the load is lifted.

Controls for Forklift Beams

I’m sure you noticed the forklift arms reaching up to the sky in the videos above, and while it may seem easy enough to create, it actually ended up being quite challenging. I wanted the platform to move up and down only when the beams themselves were in their minimum or maximum position, depending on the direction the overall forks were moving. Achieving this took a lot of tinkering to get right and involved some clever transformations from world to local space, alongside fine-tuning of values.

Another issue I encountered involved the audio for the forks moving, with a looping sound that plays when the platform is attempting to move. Once I got that all sorted I was able to mark this one off the list.

Sound on – The final fork moving sounds on display

Fork Lasers

Oh yes, you read that correctly. Fork Lasers are exactly what they sound like – lasers that are shot from the forks on the front of the platform. Why add these? Well, during my prototyping, I noticed I had a hard time aligning the forks with the cargo holding slots. To remedy this, I thought it would be helpful to have a laser that the operator can toggle on and off to assist in securing cargo in hard-to-reach locations.

The actual laser is a Line Renderer component with a beautiful gradient. A max value property limits its reach within the warehouse. A raycast is used to determine if the laser has hit an object, at which point I dynamically change the end point of the laser. The result? A pretty awesome mechanic that I believe will have various other uses as I continue building out the levels.

Fork Lasers in action

Multiple Cameras

In those moments when the trusty Fork Lasers are not enough, I wanted to offer some additional camera angles for the operator to have at their disposal. The main camera is a dynamic 3rd-person camera with a focus point that follows a reference game object placed on the forks. As they lift, it follows, all while keeping the player in frame and orbiting around the actual forklift.

The next camera is a cab camera, giving you a more sim-like first-person view. This angle provides a clear view of the road ahead and your cargo. Personally, I’m a fan of first-person views in driving games for immersion reasons.

The third and final camera places you directly on the forks. This is intended for use when there is no cargo on the forks, and you’re attempting to secure something that has an odd shape in a hard-to-reach location. You can check out a quick cycle through all three below, which is done using the Cycle Camera input action.

Showcasing all three cameras

Engine Sounds

Going into this project, I had a pretty good idea of how to handle many of the challenges listed above, but one challenge caught me completely unprepared – engine sounds. Sure, I could have simply looped a sound while idling, added an acceleration sound, deceleration sound, and so on. However, I wanted the forklift motor to sound realistic and not be horribly annoying to listen to, considering players would spend a lot of time in this machine throughout the game.

After some trial and error, I turned to the Unity Asset Store and acquired the Realistic Engine Sounds 2 asset, which significantly improved the sound of my forklift. I had to engage in a lot of custom coding to incorporate an automatic transmission into my forklift and simulate the RPMs of the motor to pass along to this new asset. It was indeed a challenge, but the end result was music—or rather, pleasing engine sounds to my ears.

Showcasing Realistic Engine Sounds 2 in my game

Item System

While initially just a loud horn, the operator could honk, the item system served the purpose of giving the player another action to perform while driving.

Horn item attached to forklift

In the case of the horn, it would alert NPC coworkers to get out of your way while you navigate the busy warehouse floor. However, if you’ve read the marketing page on this site, you’ll see that this game is going to go beyond just carrying pallets in a warehouse. That’s when I came up with another significant mechanic for my game, inspired by MetroidVania games, where certain levels and areas require a specific item or tool to access. The operator will collect these unique items as they progress through the game, ultimately opening up new ways to complete previous levels or access entirely new areas. Admittedly, this is subject to change, but to start, I knew two items I wanted to have: the horn and the booster.

Booster Item

User Interface

To keep the operator informed about the state of various systems on the forklift, I utilized another high-quality third-party asset from Synty Studios. You might be wondering why a professional UI/UX designer would use such an asset. The truth is, the visuals for a website and those for a casual video game are quite different. This difference boils down to modern design aesthetics versus a more skeuomorphic approach. I aim for players to feel that the UI is part of the same world they are exploring, distinct from diegetic UI elements that physically exist in the game world on a world space UI canvas. I also am still learning the ropes when it comes to Unity’s UI system.

Now, back to the forklift. Each gauge and slider is dynamic, responding to in-game events. The fuel gauge decreases as you drive, the damage indicator lowers with each collision, and the speedometer fluctuates as you accelerate and brake. The icing on the cake is the current load weight display, which moves up and down in relation to the platform in the game. This feature effectively integrates the UI with the game world and keeps the operator informed—and does it in style.

Showcasing the UI for the Forklift

What’s Next for Forkin’ Around

Next on my agenda is the construction of a temporary hub world and the first demo level. This step is crucial for establishing the necessary game objects in each scene, identifying which ones will transition between scenes, and so on. It also marks my first deep dive into the intricacies of level design and, even more crucially, puzzle design. I’m excited to tackle these challenges.

I’d love to hear your thoughts on this approach. Let me know in the comment section below what you’re currently working on, or if you have any insights or feedback on my plan.

Stay in the loop

Thank you for investing your time in reading this story. If you found it enjoyable and would like to accompany me on this journey, you can sign up to receive email notifications whenever I publish new Quest Logs and other updates from Lunar Lark Games.
Leave a Reply

Your email address will not be published. Required fields are marked *

    Lunar Lark Games Logo - Text
    An indie game developer currently working on my first game, 'Cuppa Cozy.'
    Illustration of kitty in rocket orbiting a planet.
    Orbit with Us
    © 2025 LunarLark Games. All Rights Reserved.
    Lunar Lark Guest Log Badge

    Join the Newsletter

    Sometimes I send out emails to subscribers with news on upcoming games, requests for play testers, and community feedback.