Skip to content

🐛 Part 2 - Fixing Some Bugs


Summary

The prototype runs, but the player does not move and collisions do not work. In this part, you will fix those issues.


Challenge One - Get the Player Moving

The values that control the car movement are set to zero.

Your Task

  • Select the ----- Player GameObject in the Hierarchy.
  • In the Inspector, find the Player Controller script.
  • Set Turn Speed to 200 and Move Speed to 10 as starting values.
  • Test the game and tweak the values to your liking.

Select the player in the Hierarchy

Player Controller values


Challenge Two - Add Physics

Right now the player can drive through everything.

Your Task

  • Select the ----- Player GameObject in the Hierarchy.
  • Add a Rigidbody2D component.
  • Set the Gravity Scale to 0.
  • Test collisions again.

Add Rigidbody2D

Set Gravity Scale to 0


Checklist

  • The player moves using the input controls.
  • Collisions now work.
  • Gravity Scale is set to 0 on the player.