2d and 3d Motorbike game tutorial


This post is dedicated to all the game developers who wants to learn programming games like Bike Baron, Trials Frontier, Trial Extreme, Bike Race, Bike Racing, Bike Rivals, Extreme Bike Stunts, Mad Skills Motorbike, etc. this all games have about more than 1 million download and few have more than 10 million download.Indeed, motorbike stunts game have a huge popularity all over the world.

After researching, I realized that similar game physics are released with different visual and game design are released in the market since a decade but the core mechanics of all the game remains the same. So you can develop the core module once and publish several different design games. the best and most popular example is “Trail Extreme series” which have released 4 games in the market  in the last 3 years with different designs and all have above a million download.

So i started my development process to design a core module which will support motorbike movement physics,  rag doll character behavior and a very robust module in which you can create similar games i mentioned in the beginning. This work was completed in a month precisely.

before we proceed let me give you a short step by step procedure to develop this project.

1> For 2d and 3d game development, I have chosen Unity3D as the game engine.

2> You can download the required materials and models from Turbo Squid. these models are available for free. You will need a motorbike and a character. remember these model should support rag doll behavior and motorbike where components can be separated. I have attached a image for a reference and a link at the bottom where you can download these models.


3> We will need to create a new scene in unity and construct a terrain for a mountainous road so that the player can test its front and backward movement and control its physics balance. creating terrain is a very easy process. there are many tutorials available on YouTube.

4>So now after you have a rocky mountainous terrain, the motorbike and the character with its materials. You will need to drag those in the scene and add collider to the game object models for a motorbike and the character. I have attached a hierarchy which you will need to maintain for a very robust physics rag doll behavior. please add a character joint for the hips, shoulders, back, legs, arms, hand. etc and capsule collider wherever you have a joint. Please note you will need a sphere collider for the front and rear tires. remember, you will need to add a hinge joint for the rear fork for its shock up tires movement and you can add a configurable joint component for the front fork.Image3

5>You will need to add the script which you can download it from http://pastebin.com/wmXSEfHY and put that in the main game object or parent game object of all those components. Remember, to have body and player and all the character movement objects as a child of this game object. You will need to attach a body trigger script for the ragdoll movement and conditions. Please do attach a rigibody and a box collider component for the main body of the bike. I have attached the script in the following link: http://pastebin.com/s9qT0iY6

6>After you have added the collider components for various gameobjects and its script. you can add a simple follow camera script and buttons as its input. remember the tedious work is only arranging the components for its behaviour and its values.

7>Remember, you will need to apply the player movements with the bike.So i request you to first follow few tutorials to understand as how a ragdoll behavior works and also the physics and movement of a motorbike control. I have attached several screenshots for you as a reference of the hierarchy of the game objects.

If you face any issue or have any questions please do write it in the comments section and i will answer it within 24 hours.

Motorcycle model is downloaded from: http://www.turbosquid.com/3d-models/3d-motorcycle-games/349482

Using male character pack from Mixamo: https://www.assetstore.unity3d.com/#/content/124

P.S: For project similar to motorbike you will need an expertise on unity game engine, any programming language like C# or javascript. Knowledge of the colliders such as box, capsule, hinge joint, configurable joint. Adding empty game objects and positioning it in the character. remember, I have attached both the scripts which are sufficient as a core module for a motorbike stunts game. This script works for both the 2d and 3d motorbike game.

Once you have mastered the core mechanics, you should be able to develop games like Bike Baron and Trials Frontier. hope to see your game on the market. All the very best. Thank you 🙂


11 thoughts on “2d and 3d Motorbike game tutorial

  1. Dear,
    At first, thank you for sharing ! I gave a try to your bike script in unity 5 with no success, even weird behavior. After correcting some lines to have a chance to debug, I finally could launch the play scene…The weird things are my character flying around all twisted( tried gravity, no gravity, is kinematic, mass change…may be character joints problems) and the body of my bike got really small. Not sure if my hierarchy was right cause I attached both scripts on the main bike with wheels and characters as childs. So could not even try the physics. If you have any idea…I will try it in unity4 to check later on. But thank you anyway

    Greg from France


    1. Hi Greg,

      I am just tweaking the script for the Unity 5 or above versions. I will send you the script with the model as a package so you can import on an empty project and continue working on it.

      I will send you the package within 24 hours.

      Hips transform and Hips position transofrm is for your ragdoll behaviour on the player. Once i send you the script and the latest package you will get a better idea as to what it does when you actually play it.



  2. Anna

    Hi! I am trying to learn Unity and I’m really interested in this tutorial. However, as I have read the comments, this only works for Unity 4. Can you send me the package for Unity 5? I would really appreciate it! thanks!


  3. Karl

    I tried making my own bike physics which actually worked out pretty good but not very good with unity 5.
    So I found your tutorial on this last week but it’s not working, exact same problem as mentioned above. So I’m asking if you could maybe send me the asset for unity 5.

    I’d appreciate it.


  4. park

    I’m really impressive your motorcycle game. But this game can’t play unity 5. could you help me If you can.I really want to make motorcycle game like your motorcycle game. If you read this message, please send me the asset for unity 5 if you have it. Thank you very much.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s