[1Ed] Prototype 2: Mission Demolition
Physics games are some of the most popular around, making games like Angry Birds household names. In this chapter, you make your own physics game that is inspired by Angry Birds and all the physics games, such as the board game Crossbows and Catapults, that came before it.
This chapter covers the following: physics, collision, mouse interaction, levels, and game state management.
- p. 479 – See note below about changes to GUIText in Unity 4.6.
- p.479 – The text of bullet point 6 reads “Create a second GUIText and name it GT_Shots.” This should be GT_Score.
Unity 4.6 and Unity 5.x Update Deprecating GUIText
Issue with Castles Falling Down On Their Own
From the menu, go to Edit > Project Settings > Physics. This is the same place that you set which physics layers collide with each other. The option Sleep Threshold has a default value of 0.005. The sleep threshold is the minimum movement that something must have to be considered “awake” by the PhysX engine. Once something moves less than 0.005 m/s, it is considered asleep, and PhysX stops thinking about it. Somehow, this is too low for castles on some machines and causes issues. If you change Sleep Threshold to 0.01, it should fix the issue.
Unity 5 Update
Unity made a few changes to their C# code for Unity 5. The PDF below contains full code listings for the FollowCam.cs, Goal.cs, ProjectileLine.cs, and Slingshot.cs code files, which all require small changes due to Unity 5. These few changes are all highlighted in yellow in the code listings.